2016-07-08 10:40:36 +01:00
|
|
|
# webpack
|
|
|
|
|
|
|
|
> Bundle a web project's js files and other assets into a single output file.
|
2019-06-03 01:06:36 +01:00
|
|
|
> More information: <https://webpack.js.org>.
|
2016-07-08 10:40:36 +01:00
|
|
|
|
|
|
|
- Create a single output file from an entry point file:
|
|
|
|
|
|
|
|
`webpack {{app.js}} {{bundle.js}}`
|
|
|
|
|
2021-08-15 18:59:09 +01:00
|
|
|
- Load CSS files too from the JavaScript file (this uses the CSS loader for `.css` files):
|
2016-07-08 10:40:36 +01:00
|
|
|
|
2021-08-15 18:59:09 +01:00
|
|
|
`webpack {{app.js}} {{bundle.js}} --module-bind '{{css=css}}'`
|
2016-07-08 10:40:36 +01:00
|
|
|
|
2021-08-15 18:59:09 +01:00
|
|
|
- Pass a config file (with e.g. the entry script and the output filename) and show compilation progress:
|
2016-07-08 10:40:36 +01:00
|
|
|
|
|
|
|
`webpack --config {{webpack.config.js}} --progress`
|
|
|
|
|
|
|
|
- Automatically recompile on changes to project files:
|
|
|
|
|
|
|
|
`webpack --watch {{app.js}} {{bundle.js}}`
|