gaearon / react-hot-boilerplate

Minimal live-editing example for React
MIT License
3.91k stars 879 forks source link

Add basic production build script #118

Closed cookpete closed 7 years ago

cookpete commented 7 years ago

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:

calesce commented 7 years ago

@CookPete Thanks, this looks great!