[Feature Request] Add alternate output option
- Dominant language
- JavaScript
- Stars
- 402
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
**I'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 directory `export`
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?
Contributor guide
Assessment
This issue has not been assessed yet.