I'm wanting to run ng build --prod
with WebStorm, however it only seems to do ng build
and misses the --prod
command.
I'm wanting to run this in WebStorm, not in the terminal.
Note: if I add --prod
to Arguments, it doesn't work:
/usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js run build --scripts-prepend-node-path=auto --prod
> [email protected] build /Users/robertking/go/src/gitlab.com/cosmoline_client
> ng build
Press Shift twice to open the search window, start typing your query, for example, npm scripts , and select Show npm scripts from the list. Alternatively, select View | Tool Windows | npm from the main menu.
The ng build command is intentionally for building the apps and deploying the build artifacts. The command does not generate an output folder. The output folder is – dist/. The ng serve builds artifacts from memory instead for a faster development experience.
Type npm run or yarn run in the search field. As you type, WebStorm shows the matching scripts. Select the required one from the list and press Enter . To view the command output in the Run tool window, press Ctrl+Enter , to show the output in the Debug tool window, press Shift+Enter .
Description. This runs an arbitrary command from a package's "scripts" object. If no "command" is provided, it will list the available scripts. run[-script] is used by the test, start, restart, and stop commands, but can be called directly, as well.
You could add --prod
to the build script inside of the package.json. For example:
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
Or add an alternate step:
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build:prod": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
If you don't want to do it in the package.json file, since WebStorm isn't running ng directly (it's running via npm), it may not be passing the attributes.
Adding an additional --
may work (e.g. -- --prod
).
Or try putting it in quotes (e.g. "--prod"
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With