mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-27 01:02:14 +05:30
Setup production optimizations
This commit is contained in:
parent
c1c9d46fda
commit
0acf1a8d97
@ -14,7 +14,6 @@ const SUPPORTED_LANGUAGES = Object.keys(require('./src/i18n/index.json'));
|
|||||||
const localeFlags = require('./src/components/i18n/localeFlags').default;
|
const localeFlags = require('./src/components/i18n/localeFlags').default;
|
||||||
const rootPath = path.resolve('./src');
|
const rootPath = path.resolve('./src');
|
||||||
const outputPath = path.join(__dirname, 'dist');
|
const outputPath = path.join(__dirname, 'dist');
|
||||||
const packageJson = require('./package.json');
|
|
||||||
|
|
||||||
let config = {};
|
let config = {};
|
||||||
try {
|
try {
|
||||||
@ -246,10 +245,6 @@ if (isProduction) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
webpackConfig.plugins.push(
|
webpackConfig.plugins.push(
|
||||||
// TODO: configure optimisations
|
|
||||||
// new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js?[hash]'),
|
|
||||||
// new webpack.optimize.DedupePlugin(),
|
|
||||||
// new webpack.optimize.UglifyJsPlugin(),
|
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: '[name].css?[hash]',
|
filename: '[name].css?[hash]',
|
||||||
chunkFilename: '[id].css?[hash]',
|
chunkFilename: '[id].css?[hash]',
|
||||||
@ -258,13 +253,19 @@ if (isProduction) {
|
|||||||
|
|
||||||
webpackConfig.devtool = 'hidden-source-map';
|
webpackConfig.devtool = 'hidden-source-map';
|
||||||
|
|
||||||
// TODO: remove me after migration
|
webpackConfig.optimization = {
|
||||||
// With this code we have tried to configure which deps have go into the 'vendor.js' chunk
|
moduleIds: 'hashed',
|
||||||
// const ignoredPlugins = ['flag-icon-css'];
|
runtimeChunk: 'single',
|
||||||
|
splitChunks: {
|
||||||
// webpackConfig.entry.vendor = Object.keys(packageJson.dependencies).filter(
|
cacheGroups: {
|
||||||
// (module) => !ignoredPlugins.includes(module)
|
vendor: {
|
||||||
// );
|
test: (m) => String(m.context).includes('node_modules') && !String(m.context).includes('flag-icon-css'),
|
||||||
|
name: 'vendors',
|
||||||
|
chunks: 'all',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
webpackConfig.plugins.push(
|
webpackConfig.plugins.push(
|
||||||
new webpack.DllReferencePlugin({
|
new webpack.DllReferencePlugin({
|
||||||
|
Loading…
Reference in New Issue
Block a user