I'm using to run "node_modules/.bin/webpack", but I know it's possible to configure the path so that you only have to type "webpack". I can't find how, though. :/
相关问题
- Ignore Typescript errors in Webpack-dev-server
- Webpack Encore: cannot import local dependencies
- Webpack getting started, import error
- Is it possible to pass command-line arguments to @
- Getting Uncaught TypeError: …default is not a cons
相关文章
- 运行"WEBPACK_ENV=online webpack -p",如何将.scss e6文件转化
- Linux - change the hostname in the CLI
- React and typescript with webpack typing issue
- Log to node console or debug during webpack build
- Configuring electron-webpack renderer to work with
- Disable tree shaking in Webpack 4
- webpack-dev-server: how to get error line numbers
- Node.js multiline input
That would happen if you install a package globally. For webpack that would be with the command
npm install -g webpack
.npm
in that case would install Webpack in a set location you can find withnpm root -g
.If that location is in your
$PATH
, you can usewebpack
directly on your command line. Do not do that! You would proabably need different versions of webpack for different projects. Instead, if you are using NPM, usenpx webpack
in directory where your project / package.json is.npx webpack
is a shortcut to./node_modules/.bin/webpack.
npx
is already included withnpm
. Read more here.Or another option is to put it in your package.json
scripts
property like:Then you can run the local webpack with the command
npm run build
.NPM will then also prefer the local version over a global version if existent.For more information, read this article: http://ericlathrop.com/2017/05/the-problem-with-npm-install-global/