There are a bunch of dead issues (#63, #90, #13, #48) and a dead PR (#81) for production builds so I thought I would put forward my effort. I tried to make it as simple and non-intrusive as possible, but rimraf, cross-env and copyfiles are required for the build to work across other environments (ie Windows).
The only weirdness is having to use static/bundle.js as the output.filename to ensure that bundle.js gets put into the /dist/static folder. This is so the reference to the bundle in index.html remains correct and we can simply copy the file into dist. Alternatively we could use html-webpack-plugin but it seems rather heavy for what should be a simple boilerplate.
The production config is essentially a copy of the development config but with:
Less code comments (to avoid too much repetition)
devtool: 'source-map'
Just the one src/index.js entry file
UglifyJsPlugin for minification instead of all the dev plugins
There are a bunch of dead issues (#63, #90, #13, #48) and a dead PR (#81) for production builds so I thought I would put forward my effort. I tried to make it as simple and non-intrusive as possible, but
rimraf
,cross-env
andcopyfiles
are required for the build to work across other environments (ie Windows).The only weirdness is having to use
static/bundle.js
as theoutput.filename
to ensure thatbundle.js
gets put into the/dist/static
folder. This is so the reference to the bundle inindex.html
remains correct and we can simply copy the file intodist
. Alternatively we could use html-webpack-plugin but it seems rather heavy for what should be a simple boilerplate.The production config is essentially a copy of the development config but with:
devtool: 'source-map'
src/index.js
entry fileUglifyJsPlugin
for minification instead of all the dev plugins