Commit 71f91f58 authored by Evan Chou's avatar Evan Chou
Browse files

fix css cache busting, dev mode tweaks for faster build

parent dae195f5
......@@ -9,6 +9,26 @@ const webpack_isomorphic_tools_plugin =
new Webpack_isomorphic_tools_plugin(require('./webpack-isotools-config'))
.development();
const devMode = process.env.NODE_ENV !== 'production';
const plugins = [
new BundleAnalyzerPlugin({
analyzerMode: 'disabled',
generateStatsFile: true,
statsOptions: { source: false }
}),
function () {
this.plugin('done', writeStats);
},
webpack_isomorphic_tools_plugin,
];
if (!devMode) {
plugins.push(new MiniCssExtractPlugin({
filename: devMode ? '[name].css' : '[name].[contenthash].css',
chunkFilename: devMode ? '[id].css' : '[id].[contenthash].css',
}));
}
const postcss_loader = {
loader: 'postcss-loader',
options: {
......@@ -21,7 +41,7 @@ const postcss_loader = {
};
const css_loaders = [
MiniCssExtractPlugin.loader,
devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
......@@ -32,7 +52,7 @@ const css_loaders = [
];
const scss_loaders = [
MiniCssExtractPlugin.loader,
devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
......@@ -108,18 +128,7 @@ module.exports = {
}
]
},
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: 'disabled',
generateStatsFile: true,
statsOptions: { source: false }
}),
function () {
this.plugin('done', writeStats);
},
webpack_isomorphic_tools_plugin,
new MiniCssExtractPlugin()
],
plugins,
resolve: {
alias: {
react: path.join(__dirname, '../node_modules', 'react'),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment