diff options
author | ThibG <thib@sitedethib.com> | 2018-07-17 21:54:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-17 21:54:12 +0200 |
commit | 012ca4c68d785dcf13e4cabd16b09a844e622f6b (patch) | |
tree | 106543bbde5ca7a43920ae13928d9ead0075e88b /config/webpack/shared.js | |
parent | 8e8491e1dab5e2ed98770710e0a32484de8530b3 (diff) | |
parent | bcf157a1a9597595c61b1cce84bd62f63fcaa90b (diff) |
Merge pull request #578 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'config/webpack/shared.js')
-rw-r--r-- | config/webpack/shared.js | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/config/webpack/shared.js b/config/webpack/shared.js index 35b9bbd1c..6b6629a37 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -1,9 +1,9 @@ // Note: You must restart bin/webpack-dev-server for changes to take effect const webpack = require('webpack'); -const { join, resolve } = require('path'); +const { basename, dirname, join, relative, resolve } = require('path'); const { sync } = require('glob'); -const ExtractTextPlugin = require('extract-text-webpack-plugin'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const ManifestPlugin = require('webpack-manifest-plugin'); const { env, settings, core, flavours, output, loadersDir } = require('./configuration.js'); const localePacks = require('./generateLocalePacks'); @@ -59,6 +59,25 @@ module.exports = { publicPath: output.publicPath, }, + optimization: { + runtimeChunk: { + name: 'locales', + }, + splitChunks: { + cacheGroups: { + default: false, + vendors: false, + locales: { + name: 'locales', + chunks: 'all', + minChunks: Infinity, + minSize: 0, + }, + }, + }, + occurrenceOrder: true, + }, + module: { rules: sync(join(loadersDir, '*.js')).map(loader => require(loader)), }, @@ -72,17 +91,13 @@ module.exports = { resource.request = resource.request.replace(/^history/, 'history/es'); } ), - new ExtractTextPlugin({ + new MiniCssExtractPlugin({ filename: env.NODE_ENV === 'production' ? '[name]-[contenthash].css' : '[name].css', - allChunks: true, }), new ManifestPlugin({ publicPath: output.publicPath, writeToFileEmit: true, - }), - new webpack.optimize.CommonsChunkPlugin({ - name: 'locales', - minChunks: Infinity, // It doesn't make sense to use common chunks with multiple frontend support. + filter: file => !file.isAsset || file.isModuleAsset, }), ], |