Improve webpack bundling #2608
Labels
Maintenance
Ticket/PR related to codebase maintenance tasks
Refactoring
Ticket/PR that is or requires a refactoring
wp-parsely
Required label for all issues
Milestone
Is your feature request related to a problem?
After the introduction of the new Smart Linking interface, when building the project with webpack, we get a particular warning regarding the bundle size.
Describe the solution you'd like
Improve the resulting bundle. Ideally, we should be able to break each individual feature into its own bundle, and enqueue the JS file each time is needed. This would also prevent loading, for example, the Smart Linking JS code when this feature is actually disabled.
This might require breaking each individual feature into an individual package and have the build script take care of those, similarly with what Gutenberg core does with its components. But I would need to do a deeper research on how that works.
Describe alternatives you've considered
Another alternative would be looking into reducing the bundle size by avoiding repeated code. One good example is the Telemetry module that is used everywhere, and it's bundled with both the
editor-sidebar.js
anddashboard-widget.js
for example. If we could externalize this module and use it without including it in the bundle, it would save some space in the final bundle, solving the warning.The text was updated successfully, but these errors were encountered: