Fix common CSS.

This commit is contained in:
Tomasz Drwięga 2018-03-12 22:24:59 +01:00
parent e65fc23bc5
commit 41c21d2b3b
No known key found for this signature in database
GPG Key ID: D066F497E62CAF66
2 changed files with 98 additions and 97 deletions

View File

@ -19,6 +19,7 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
const rimraf = require('rimraf'); const rimraf = require('rimraf');
const flatten = require('lodash.flatten'); const flatten = require('lodash.flatten');
const webpack = require('webpack');
// const ReactIntlAggregatePlugin = require('react-intl-aggregate-webpack-plugin'); // const ReactIntlAggregatePlugin = require('react-intl-aggregate-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin');
const WebpackErrorNotificationPlugin = require('webpack-error-notification'); const WebpackErrorNotificationPlugin = require('webpack-error-notification');
@ -165,17 +166,16 @@ module.exports = {
}, },
plugins: (function () { plugins: (function () {
let plugins = Shared.getPlugins(isProd, true).concat( let plugins = []
.concat(Shared.getPlugins(isProd, true))
.concat(
new WebpackErrorNotificationPlugin(), new WebpackErrorNotificationPlugin(),
new ExtractTextPlugin({ new ExtractTextPlugin({
filename: 'bundle.css', filename: '[name].css',
allChunks: true allChunks: true
}), })
); )
.concat(
plugins = [].concat(
plugins,
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
title: 'Parity Bar', title: 'Parity Bar',
filename: 'embed.html', filename: 'embed.html',
@ -256,6 +256,14 @@ module.exports = {
) )
); );
if (isProd) {
plugins.unshift(
new webpack.optimize.CommonsChunkPlugin({
name: 'commons'
})
);
}
return plugins; return plugins;
}()) }())
}; };

View File

@ -33,7 +33,7 @@ const UI_VERSION = PackageJson
}) })
.join('.'); .join('.');
function getPlugins (_isProd = isProd, withCommons = false) { function getPlugins (_isProd = isProd) {
const plugins = [ const plugins = [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': { 'process.env': {
@ -53,13 +53,6 @@ function getPlugins (_isProd = isProd, withCommons = false) {
]; ];
if (_isProd) { if (_isProd) {
if (withCommons) {
plugins.push(
new webpack.optimize.CommonsChunkPlugin({
name: 'commons'
})
)
}
plugins.push( plugins.push(
new webpack.optimize.ModuleConcatenationPlugin(), new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.optimize.UglifyJsPlugin({ new webpack.optimize.UglifyJsPlugin({