Created
March 22, 2017 08:41
-
-
Save miguelrincon/4fae792cf530552660e364352317fe28 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use `npm run --` to avoid global installs of modules | |
# We can use npm scripts to "proxy" to locally installed packages without global | |
# installations and without appending ./node_modules/... to the command we want | |
# to call. | |
# PROBLEM: | |
# Calling a locally installed module from the terminal won't work: | |
$ webpack | |
webpack: command not found | |
# Calling a locally installed module using ./node_modules is ugly | |
$ ./node_modules/webpack/bin/webpack.js --version | |
2.2.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"devDependencies": { | |
"webpack": "*", | |
"karma": "*" | |
}, | |
"scripts": { | |
"webpack": "webpack", | |
"karma": "karma" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use npm to call webpack with double dash: "npm run --" | |
$ npm run webpack -- --version | |
> [email protected] webpack /home/miguelrincon/myproject | |
> webpack "--version" | |
2.2.1 | |
# Use any argument | |
$ npm run webpack -- stats | |
> [email protected] webpack /home/miguelrincon/myproject | |
> webpack "stats" | |
... | |
bundle.js 2.02 MB 0 [emitted] [big] main | |
[1] ../~/webpack/buildin/global.js 509 bytes {0} [built] | |
+ 26 hidden modules | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment