@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
46 lines (45 loc) • 2.28 kB
JavaScript
module.exports = {
optimization: {
minimize: true,
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
minSize: 16384, // in bytes
maxInitialRequests: 20,
cacheGroups: {
msftSme: {
test(module, chunks) {
// separate core and angular packages into different bundle.
// `module.resource` contains the absolute path of the file on disk.
// Note the usage of `path.sep` instead of / or \, for cross-platform compatibility.
const path = require('path');
return module.resource
&& module.resource.includes(`${path.sep}node_modules${path.sep}`)
&& module.resource.includes(`${path.sep}@msft-sme${path.sep}`);
},
name(module) {
const packageName = module.context.match(/[\\/]node_modules[\\/]@msft-sme[\\/](.*?)([\\/]|$)/)[1];
return `msftsme.${packageName.replace('@', '')}`;
},
reuseExistingChunk: true
},
vendor: {
test(module, chunks) {
// rest of packages are separated to each bundle file.
// `module.resource` contains the absolute path of the file on disk.
// Note the usage of `path.sep` instead of / or \, for cross-platform compatibility.
const path = require('path');
return module.resource
&& module.resource.includes(`${path.sep}node_modules${path.sep}`)
&& !module.resource.includes(`${path.sep}@msft-sme${path.sep}`);
},
name(module) {
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
return `vendor.${packageName.replace('@', '')}`;
},
reuseExistingChunk: true
}
}
}
}
};