Issue #645
Install webpack
1 2 3
| npm init npm install webpack webpack-cli --save-dev vim webpack.config.js
|
1 2 3 4 5 6 7
| module.exports = { entry: "./index.js", mode: 'production', output: { filename: "./index.js" } }
|
To invoke webpack, run below. Your output is dist/index.js
Minify js
1
| npm install babel-minify-webpack-plugin --save-dev
|
Minify html
1
| npm install html-webpack-plugin --save-dev
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| const MinifyPlugin = require('babel-minify-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = { entry: "./index.js", mode: 'production', output: { filename: "./index.js" }, plugins: [ new MinifyPlugin(), new HtmlWebpackPlugin({ template: 'index.html', filename: 'index.html', minify: { collapseWhitespace: true } }) ] }
|
Minify css
TBD
Copy files
Copy files from dist
to public folder so we can use
1
| npm install copyfiles -g
|
Then in package.json
1 2 3
| "scripts": { "copy": "copyfiles -u 1 dist/* ../apps/ && copyfiles *.css ../apps" }
|
Then run npm run copy
Updated at 2020-04-28 13:18:40