@wjunt/webpack-config
Version:
Presets of webpack config
25 lines (24 loc) • 603 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function splitChunks(options = 'vendors') {
let cacheGroupKey;
if (typeof options === 'string') {
options = {
name: options,
test: /node_modules/,
chunks: 'initial',
priority: -10,
};
}
cacheGroupKey = options.name;
return {
optimization: {
splitChunks: {
cacheGroups: {
[cacheGroupKey]: options,
},
},
},
};
}
exports.splitChunks = splitChunks;