Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #77 from wearereasonablepeople/piotr/runtime-chunk
Browse files Browse the repository at this point in the history
Allow to override optimization options
  • Loading branch information
Piotr Gawlowski committed Oct 9, 2018
2 parents 22670cc + fd07945 commit f2bce3e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion getConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const resolve = () => ({

const entry = (ent = './src/index.js', cwd = process.cwd()) => path.resolve(cwd, ent);

const optimization = op => op || optimizations();
const optimization = op => optimizations(op);

const defaultPath = path.resolve(process.cwd(), 'dist');
const output = (out = {}) => ({
Expand Down
27 changes: 15 additions & 12 deletions optimizations/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');

module.exports = () => ({
module.exports = ({
runtimeChunk = 'single',
splitChunks = {
chunks: 'all',
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
}
}
}
} = {}) => ({
minimizer: [
new UglifyJsPlugin({
sourceMap: false,
Expand All @@ -14,15 +26,6 @@ module.exports = () => ({
}),
new OptimizeCSSAssetsPlugin({})
],
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
}
}
}
runtimeChunk,
splitChunks,
});

0 comments on commit f2bce3e

Please sign in to comment.