diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js index 0897dbcf..d3b592fe 100644 --- a/config/webpack.config.prod.js +++ b/config/webpack.config.prod.js @@ -37,6 +37,33 @@ const extractTextPluginOptions = shouldUseRelativeAssetPaths { publicPath: Array(cssFilename.split('/').length).join('../') } : {}; +// Enable users to turn off dead code elimination. +const deadCodeElimination = + process.env.DEAD_CODE_ELIMINATION !== 'true' + ? { + dead_code: true, + pure_funcs: [ + '_elm_lang$core$Native_Utils.update', + 'A2', + 'A3', + 'A4', + 'A5', + 'A6', + 'A7', + 'A8', + 'A9', + 'F2', + 'F3', + 'F4', + 'F5', + 'F6', + 'F7', + 'F8', + 'F9' + ] + } + : {}; + module.exports = { // Don't attempt to continue if there are any errors. bail: true, @@ -185,29 +212,12 @@ module.exports = { // Minify the compiled JavaScript. new UglifyJsPlugin({ - compress: { - warnings: false, - dead_code: true, - pure_funcs: [ - '_elm_lang$core$Native_Utils.update', - 'A2', - 'A3', - 'A4', - 'A5', - 'A6', - 'A7', - 'A8', - 'A9', - 'F2', - 'F3', - 'F4', - 'F5', - 'F6', - 'F7', - 'F8', - 'F9' - ] - }, + compress: Object.assign( + { + warnings: false + }, + deadCodeElimination + ), output: { comments: false } diff --git a/template/README.md b/template/README.md index ea91c764..37b1b496 100644 --- a/template/README.md +++ b/template/README.md @@ -20,6 +20,7 @@ You can find the most recent version of this guide [here](https://github.com/hal - [make](#make) - [reactor](#reactor) - [Turning on/off Elm Debugger](#turning-onoff-elm-debugger) +- [Dead code elimination](#dead-code-elimination) - [Changing the Page `