more sensible code splitting options for vendor.js in quasar #12489
-
So.. I have a problem with the vendor option in quasar.conf.js. I am using some pretty large libraries with no tree-shaking available such as danfo.js which has things like xlsc, plotly and mathjs as dependencies which are each pretty large by themself. (see the image) So I can already remove those libraries from vendor.js by doing something like this:
The problem is: that doesn't remove all depencies from danfo... There are way more dependencies involved here. In the following picture you can see that there is a whole bunch of small libraries which get added to vendor.js chunk those small libraries are all dependencies of amplify & danfo. Of course I could sit down and go through this list manually but I feel like there is a better way to do this... I am importing danfo.js lazily through
} to make sure I get the quasar packages etc.. in vendor.js but this doesn't work either, as disable:true also makes the "add" stop working.. I don't really understand the purpose of "add" |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
ok.. I have put some more research into this and basically found my own solution completely overriding quasar package bundling: chainWebpack ( chain ) {
if(ctx.prod) {
chain.optimization.splitChunks({
...chain.optimization.get('splitChunks'),
minSize: 20000,
cacheGroups: {
vendor_initial: {
test: /[\\/]node_modules[\\/]/,
priority: 20,
reuseExistingChunk: true,
name: 'vendor',
chunks: 'initial',
},
vendor_whitelist: {
test: /[\\/]node_modules[\\/](vue|quasar|axios|core-js)[\\/]/,
priority: 20,
reuseExistingChunk: true,
name: 'vendor',
chunks: 'all',
},
}
})
}
} I would like to add this to the discussion... I think solution has several advantages:
I am somewhat of a newbie doing these things though. And would like to know If my list above is correct? Would it make sense to introduce such a configuration "by default" in quasar? |
Beta Was this translation helpful? Give feedback.
-
Thanks for this. Vastly improved the loading time of my web app as well. Thanks! |
Beta Was this translation helpful? Give feedback.
ok.. I have put some more research into this and basically found my own solution completely overriding quasar package bundling: