[Feature Request] Add alternate output option
See original GitHub issueI’m submitting a feature request
- Library Version: 0.23.0
Please tell us about your environment:
-
Operating System: Windows 10
-
Language: ESNext
Current behavior:
It is currently not possible to change your output directory when running au build
.
You are currently unable to change it through editing the build tasks, because the CLI bundler will use the new output path when finding & replacing the script tag src in index.html
. It won’t be able to update the vendor-bundle
src.
https://github.com/aurelia/cli/blob/master/lib/build/bundle.js#L217
Expected/desired behavior: The ability to specify the output directory for a build, depending on the environment.
We tried with the following snippet inserted in the build.js
task, but it was unable to update vendor-bundle in the index file.
import {CLIOptions, build} from 'aurelia-cli';
import project from '../aurelia.json';
if (CLIOptions.hasFlag('output')) {
project.build.targets[0].output = CLIOptions.getFlagValue('output');
}
- What is the expected behavior?
The command
au build --env prod --output export
Should output to the directoryexport
I feel like we should look at changing the way CLI updates the path to vendor-bundle
. Maybe the setIndexFileConfigTarget
part should be a task that the developer can edit themselves?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:8 (5 by maintainers)
@CasiOo If there are ideas behind
targetS
(as in more than one) I couldn’t find anything in the code (which only usestargets[0]
). Theau build
should now however work with anything after--env
so it would be possible to buildweb
,cordova
orelectron
with this. (Or evencordova-dev
,electron-prod
and so on.)Furthermore,
aurelia.json
seems to currently only support oneplatform
per project. I think there’s more to do if we’re to have true multi platform projects. And that might also include a--platform
flag for thebuild
command, making it, for example,au build --platform cordova --env dev --watch
for multi platform projects.https://github.com/aurelia/cli/pull/765