|
1 | 1 | # Learning WEBPACK - MODULE BUNDLER |
2 | 2 |
|
3 | | -|Example No.|Execution Command|Comments| |
4 | | -|-----------|-----------------|--------| |
5 | | -|1, 2| ```webpack entry.js bundle.js``` | | |
6 | | -|3| |we need the ```css-loader``` to process CSS files. We also need the ```style-loader``` to apply the styles in the CSS file. They need to be installed locally, without ```-g```| |
7 | | -|4|```webpack entry.js bundle.js --module-bind 'css=style!css'``` | if you are using ```bash``` then use single quotes in Command. Please see https://github.com/webpack/webpack/issues/1453 for more information| |
8 | | -|5|```webpack``` **OR** ```webpack --progress --colors``` **OR** ```webpack --progress --colors --watch``` | | |
9 | | -|6|```webpack-dev-server --progress --colors --watch```|webpack-dev-server is a development server, it binds a small express server on localhost:8080 which serves your static assets as well as the bundle | |
| 3 | +|Eg.No.|Execution Command|Comments| |
| 4 | +|------|-----------------|--------| |
| 5 | +|1|```webpack entry.js bundle.js```|Webpack will read entry.js file to build bundle.js| |
| 6 | +|2|```webpack entry.js bundle.js -p``` |```-p``` is used for bundle minification| |
| 7 | +|2|```webpack entry.js bundle.js -d```|```-d``` is used for bundle with source maps| |
| 8 | +|3|```webpack entry.js bundle.js --progress```|Know the progress of building the bundle| |
| 9 | +|3|```webpack entry.js bundle.js --colors```|Display text in colors| |
| 10 | +|4|```webpack entry.js bundle.js```|we need the ```css-loader``` to process CSS files. We also need the ```style-loader``` to apply the styles in the CSS file. They need to be installed locally, without ```-g```| |
| 11 | +|5|```webpack entry.js bundle.js --module-bind 'css=style!css'``` | This will simplify the CSS require path. Note: If you are using ```bash``` then use single quotes in Command. Please see https://github.com/webpack/webpack/issues/1453 for more information| |
| 12 | +|6|```webpack```|Webpack will read ```webpack.config.js``` from the root directory to build bundle.js| |
| 13 | +|7|```webpack --watch```|Will keep a watch on files to automatically rebuild the bundle| |
| 14 | +|7|```webpack-dev-server```|webpack-dev-server is a development server, it binds a small express server on localhost:8080 which serves your static assets as well as the bundle| |
| 15 | +|8|```webpack```|Multiple entry files are allowed| |
| 16 | +|9|```webpack```|Code splitting and loading files on demand, Open browser and try ```localhost:8080``` see content-1 is loaded but not content-2, Now try execute ```localhost:8080/#load``` see content-1 and content-2 are both loaded| |
0 commit comments