I’m currently migrating my app from my own vue components to the components from @nextcloud/vue.
Being mostly done, i took a look at the compiled files and noticed that they’re a lot bigger than before. Even after dropping some dependencies like jQuery it’s still ~90% more than before. I’ve tried using chunks to load most of it only when it’s actually needed, but even with that the main app.js is still 2.6Mb from 1.5mb before. The sidebar alone now needs 2.7Mb after it was included in the app.js before.
I’m already using webpack to uglify the Js, so that won’t help me.
Looking at the js files i can see that there is a lot of stuff in there that i don’t use but that is loaded by the components by default. (e.G. Datepicker, tons of translations etc.) Is there any way to strip that?
I also see that the files still contain CSS, while i thought that that would be moved to my app.css file during compilation. Is there any way to archive that? My webpack config contains the following section to extract CSS:
{
test: /\.s?css$/,
use : [
{loader: 'vue-style-loader'},
{
loader : MiniCssExtractPlugin.loader,
options: {
esModule: true
}
},
{
loader : 'css-loader',
options: {
esModule: true,
modules : 'global',
url : {
filter: (url) => {
return url.indexOf('/apps/passwords/') === -1;
}
}
}
},
{
loader : 'sass-loader',
options: {
sassOptions: {
sourceMap : !production,
outputStyle: production ? 'compressed':null
}
}
},
{
loader : 'sass-resources-loader',
options: {
resources: [
`${__dirname}/src/scss/Partials/_variables.scss`
]
}
}
]
},
Edit: I found the reason for the gigantic sidebar js file. Apparently i once loaded NcSelect from @nextcloud/vue
instead of specifying the path which loaded all Nextcloud components including 800kb of emojis. Now my sidebar “only” needs 633kb. That still doesn’t fix my bloated app.js