2025-03-14 21:59:59 -06:00
|
|
|
# webpack
|
|
|
|
|
|
|
|
|
|
> Bundle a web project's js files and other assets into a single output file.
|
2025-12-16 10:20:31 -07:00
|
|
|
> More information: <https://webpack.js.org/api/cli/>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Create a single output file from an entry point file:
|
|
|
|
|
|
|
|
|
|
`webpack {{app.js}} {{bundle.js}}`
|
|
|
|
|
|
|
|
|
|
- Load CSS files too from the JavaScript file (this uses the CSS loader for CSS files):
|
|
|
|
|
|
|
|
|
|
`webpack {{app.js}} {{bundle.js}} --module-bind '{{css=css}}'`
|
|
|
|
|
|
|
|
|
|
- Pass a configuration file (with e.g. the entry script and the output filename) and show compilation progress:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`webpack {{[-c|--config]}} {{webpack.config.js}} --progress`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Automatically recompile on changes to project files:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`webpack {{[-w|--watch]}} {{app.js}} {{bundle.js}}`
|