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

53 lines
1.4 KiB
JavaScript
Raw Normal View History

2017-05-17 07:09:47 +00:00
/* eslint-disable */
2016-02-27 21:53:11 +00:00
var path = require('path');
var webpack = require('webpack');
2016-05-24 03:35:19 +00:00
var HtmlWebpackPlugin = require('html-webpack-plugin');
2017-05-17 07:09:47 +00:00
var ExtractTextPlugin = require('extract-text-webpack-plugin');
2016-02-27 21:53:11 +00:00
commonWebpackConfig = require('./webpack.config');
productionWebpackConfig = Object.assign(commonWebpackConfig, {
cache: true,
devtool: 'cheap-module-source-map',
2017-05-17 07:09:47 +00:00
entry: ['babel-polyfill', 'babel-regenerator-runtime', './frontend/index'],
2016-02-27 21:53:11 +00:00
output: {
path: path.join(__dirname, 'dist'),
2016-05-24 03:35:19 +00:00
filename: 'bundle.[hash].js',
publicPath: '/static/',
2016-02-27 21:53:11 +00:00
},
});
productionWebpackConfig.module.loaders.push({
test: /\.s?css$/,
2017-05-17 07:09:47 +00:00
loader: ExtractTextPlugin.extract(
'style-loader',
'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!sass?sourceMap'
),
});
2017-05-17 07:09:47 +00:00
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()
);
2016-06-05 02:03:00 +00:00
productionWebpackConfig.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
2017-05-17 07:09:47 +00:00
warnings: false,
},
2016-06-05 02:03:00 +00:00
})
);
2016-02-27 21:53:11 +00:00
productionWebpackConfig.plugins.push(
new webpack.DefinePlugin({
'process.env': {
2017-05-17 07:09:47 +00:00
NODE_ENV: JSON.stringify('production'),
},
2016-02-27 21:53:11 +00:00
})
);
module.exports = productionWebpackConfig;