Move to shared babel/webpack config#1659
Conversation
f433cc2 to
229eb0a
Compare
| webpackConfig.optimization.splitChunks.cacheGroups = { | ||
| defaultVendors: { | ||
| test(module) { | ||
| return module.resource && module.resource.includes(`${path.sep}node_modules${path.sep}`) && | ||
| !module.resource.includes(`${path.sep}highlight.js${path.sep}`) | ||
| }, | ||
| name: 'vendors', | ||
| } | ||
| } |
There was a problem hiding this comment.
it makes sure that vendor files get into a separate chunk, except the highlight js ones which should stay at one chunk per supported syntax highlighting language.
There was a problem hiding this comment.
What benefit do we get from this?
There was a problem hiding this comment.
Vendors are nice to split as long as they don't get all used at the same time, right?
Like dynamic loading?
But if we always end up loading 90% of the chunks, we just create more bandwith and doesn't help cleaning the bundles imho :)
There was a problem hiding this comment.
The main issue i have is that I fail to tell webpack to only split off the highlight.js chunks and the ones that are dynamically imported (e.g. for only loading the files app init code and not the whole viewer component right away). Therefore I went for that hybrid approach that unfortunately leaves one extra chunk.
There was a problem hiding this comment.
I'm happy to look into that into a follow up again 😉
There was a problem hiding this comment.
You can do that with an ignore plugin and do a dynamic import of the highlight lib :)
https://github.com/nextcloud/contacts/blob/017026a8e42717cc8e1935af5ce61aa46b3e9f79/webpack.js#L8
There was a problem hiding this comment.
Iirc, any direct runtime import will overrule compile time bundling
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Uh oh!
There was an error while loading. Please reload this page.