diff options
Diffstat (limited to 'webpack.config.prod.js')
| -rw-r--r-- | webpack.config.prod.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/webpack.config.prod.js b/webpack.config.prod.js new file mode 100644 index 0000000..8906c00 --- /dev/null +++ b/webpack.config.prod.js @@ -0,0 +1,46 @@ +const webpack = require('webpack'); +const path = require('path'); +const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); +// const CleanWebpackPlugin = require('clean-webpack-plugin'); + +module.exports = { + entry: { + main: './client/index.js', + }, + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'index.js', + }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': '"production"' + }), + new UglifyJsPlugin(), + new webpack.optimize.AggressiveMergingPlugin() + ], + devtool: 'inline-source-map', + module: { + rules: [ + { + test: /\.css$/, + use: ['style-loader', 'css-loader'] + }, + { + test: /\.js$/, + include: path.resolve(__dirname, 'client'), + exclude: /(node_modules|bower_components|build)/, + loader: 'babel-loader', + options: { + presets: ['env'], + plugins: [ + require('babel-plugin-transform-runtime'), + require('babel-plugin-transform-es2015-arrow-functions'), + require('babel-plugin-transform-object-rest-spread'), + require('babel-plugin-transform-class-properties'), + require('babel-plugin-transform-react-jsx'), + ] + } + } + ] + }, +}; |
