Webpack update for fixing Gutenberg translations.

This commit is contained in:
mateuswetah 2020-10-08 18:41:00 -03:00
parent e500e44eb4
commit ebc7f73e27
1 changed files with 13 additions and 2 deletions

View File

@ -110,7 +110,7 @@ module.exports = {
};
// Change to true for production mode
const production = false;
const production = true;
if (production === true) {
const TerserPlugin = require('terser-webpack-plugin');
@ -129,7 +129,18 @@ if (production === true) {
}),
new TerserPlugin({
parallel: true,
sourceMap: false
sourceMap: false,
cache: true,
terserOptions: {
// We preserve function names that start with capital letters as
// they're _likely_ component names, and these are useful to have
// in tracebacks and error messages.
keep_fnames: /__|_x|_n|_nx|sprintf|^[A-Z].+$/,
output: {
comments: /translators:/i,
},
},
extractComments: false,
}),
new webpack.LoaderOptionsPlugin({
minimize: true