mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
Reduce size of client js bundles (#15264)
* add packages * Only include the needed parts of BootstrapVue * remove yargs from client * treeshake validator library * formatting * fix import
This commit is contained in:
@@ -76,6 +76,9 @@ const webpackPlugins = [
|
||||
if ((context.includes('sinon') || resource.includes('sinon') || context.includes('nise')) && nconf.get('TIME_TRAVEL_ENABLED') !== 'true') {
|
||||
return true;
|
||||
}
|
||||
if (context.includes('yargs')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
}),
|
||||
@@ -91,6 +94,28 @@ module.exports = {
|
||||
dependency: { not: ['url'] },
|
||||
type: 'asset/source',
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
// Exclude transpiling `node_modules`, except `bootstrap-vue/src`
|
||||
exclude: /node_modules\/(?!bootstrap-vue\/src\/)/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@babel/preset-env'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
// Exclude transpiling `node_modules`, except `bootstrap-vue/src`
|
||||
exclude: /node_modules\/(?!validator)/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@babel/preset-env'],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
@@ -102,6 +127,10 @@ module.exports = {
|
||||
stream: false,
|
||||
timers: require.resolve('timers-browserify'),
|
||||
},
|
||||
alias: {
|
||||
// Alias for using source of BootstrapVue
|
||||
'bootstrap-vue$': 'bootstrap-vue/src/index.js',
|
||||
},
|
||||
},
|
||||
plugins: webpackPlugins,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user