UNPKG

react-express-boilerplate

Version:

Server Side Rendering (only production mode) using express.

80 lines (78 loc) 2.27 kB
const webpack = require("webpack"); const ExtractTextPlugin = require("extract-text-webpack-plugin"); const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin"); module.exports = { entry: [ './src/client.js' ], output: { path: __dirname + '/public', filename: 'bundle.js' }, plugins: [ new ExtractTextPlugin({ filename: 'www.min.css', allChunks: false }), new webpack.LoaderOptionsPlugin({ minimize: true, }), new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('production') } }), new webpack.optimize.UglifyJsPlugin({ minimize: true, compress: { warnings: false, unused: true }, output: { comments: false } }), new OptimizeCssAssetsPlugin({ cssProcessorOptions: { discardComments: { removeAll: true } } }) ], module: { rules: [ { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/, options: { cacheDirectory: true, presets: ['es2015', 'react', 'stage-0'], plugins: [ 'transform-decorators-legacy', 'transform-class-properties' ] } }, { test: /\.(ico|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/, loader: 'url-loader', options: { name: 'assets/[hash].[ext]', limit: 10000, }, }, { test: /\.css$/, loader: ExtractTextPlugin.extract('css-loader'), exclude: /node_modules/ }, { test: /\.less$/, loader: ExtractTextPlugin.extract('css-loader!postcss-loader!less-loader'), exclude: /node_modules/ } ] } };