mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
remove sinon and moment locales to shrink client bundle
This commit is contained in:
@@ -5,8 +5,7 @@ const nconf = require('nconf');
|
||||
const vueTemplateCompiler = require('vue-template-babel-compiler');
|
||||
const setupNconf = require('../server/libs/setupNconf');
|
||||
const pkg = require('./package.json');
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
const TerserPlugin = require("terser-webpack-plugin");
|
||||
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
|
||||
|
||||
const configFile = path.join(path.resolve(__dirname, '../../config.json'));
|
||||
|
||||
@@ -44,16 +43,38 @@ envVars
|
||||
|
||||
const webpackPlugins = [
|
||||
new webpack.DefinePlugin(envObject),
|
||||
new MomentLocalesPlugin({
|
||||
localesToKeep: ['bg',
|
||||
'cs',
|
||||
'da',
|
||||
'de',
|
||||
'en',
|
||||
'es',
|
||||
'fr',
|
||||
'he',
|
||||
'hu',
|
||||
'id',
|
||||
'it',
|
||||
'ja',
|
||||
'nl',
|
||||
'pl',
|
||||
'pt',
|
||||
'pt-br',
|
||||
'ro',
|
||||
'ru',
|
||||
'sk',
|
||||
'sv',
|
||||
'tr',
|
||||
'uk',
|
||||
'zh-cn',
|
||||
'zh-tw'
|
||||
],
|
||||
}),
|
||||
new webpack.IgnorePlugin({
|
||||
checkResource(resource, context) {
|
||||
if (context.includes('sinon') || context.includes('nise')) {
|
||||
if ((context.includes('sinon') || resource.includes('sinon') || context.includes('nise')) && nconf.get('TIME_TRAVEL_ENABLED') !== 'true') {
|
||||
return true;
|
||||
}
|
||||
if (context.includes('bootstrap-vue')) {
|
||||
if (resource.includes('/icons')) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user