This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/webpack.config.prod.js
2017-05-17 19:49:30 -07:00

53 lines
1.4 KiB
JavaScript

/* eslint-disable */
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
commonWebpackConfig = require('./webpack.config');
productionWebpackConfig = Object.assign(commonWebpackConfig, {
cache: true,
devtool: 'cheap-module-source-map',
entry: ['babel-polyfill', 'babel-regenerator-runtime', './frontend/index'],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.[hash].js',
publicPath: '/static/',
},
});
productionWebpackConfig.module.loaders.push({
test: /\.s?css$/,
loader: ExtractTextPlugin.extract(
'style-loader',
'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!sass?sourceMap'
),
});
productionWebpackConfig.plugins.push(
new HtmlWebpackPlugin({
template: 'server/static/index.html',
})
);
productionWebpackConfig.plugins.push(
new ExtractTextPlugin('styles.[hash].css')
);
productionWebpackConfig.plugins.push(
new webpack.optimize.OccurenceOrderPlugin()
);
productionWebpackConfig.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
},
})
);
productionWebpackConfig.plugins.push(
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
})
);
module.exports = productionWebpackConfig;