Skip to content

Commit 6a8dddd

Browse files
committed
Build optimization
- Additional modules listed as externals - Fix for #19
1 parent 4037885 commit 6a8dddd

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

config/webpack/app-production.js

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ module.exports = function configFactory(ops) {
4040
NODE_ENV: JSON.stringify('production'),
4141
},
4242
}),
43-
4443
new OptimizeCssAssetsPlugin({
4544
cssProcessorOptions: {
4645
/* Due to the way our styles are organized, these dangerous

config/webpack/lib-base.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ module.exports = function configFactory(ops) {
3737
context: ops.context,
3838
entry: ops.entry,
3939
externals: [
40-
'babel-runtime',
40+
/babel-runtime/,
4141
'lodash',
4242
'moment',
4343
'prop-types',
4444
'react',
4545
'react-css-super-themr',
46-
'react-dom',
46+
/react-dom/,
4747
'react-helmet',
48+
/react-hot-loader/,
4849
'react-redux',
4950
'react-router-dom',
5051
'redux',

config/webpack/lib-production.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
* Development Webpack configuration for ReactJS libraries.
33
*/
44

5+
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
56
const path = require('path');
7+
const webpackMerge = require('webpack-merge');
68
const baseFactory = require('./lib-base');
79

810
/**
@@ -21,11 +23,24 @@ const baseFactory = require('./lib-base');
2123
* @return {Object} Webpack configuration.
2224
*/
2325
module.exports = function configFactory(ops) {
24-
return baseFactory({
26+
const baseConfig = baseFactory({
2527
...ops,
2628
babelEnv: 'production',
2729
cssLocalIdent: '[hash:base64:6]',
2830
mode: 'production',
2931
outputPath: path.resolve(__dirname, ops.context, 'dist/prod'),
3032
});
33+
return webpackMerge(baseConfig, {
34+
plugins: [
35+
new OptimizeCssAssetsPlugin({
36+
cssProcessorOptions: {
37+
/* Due to the way our styles are organized, these dangerous
38+
* optimizations can break our styles, thus they are disabled. */
39+
discardUnused: false,
40+
reduceIdents: false,
41+
zindex: false,
42+
},
43+
}),
44+
],
45+
});
3146
};

0 commit comments

Comments
 (0)