And it generates both index.js and react.js files, but I can’t find any reference in index to that react.js And when I try to load a plugin, it just doesn’t - blank panel and no errors.
What am I missing? Is it even worth bothering with asset file sizes?
I don’t know TBH Webpack gives these performance warnings because of sizes. I know I can turn them off via config, but thought maybe warnings are not just because
Actually I started to look into this more because I had to use lazy loading (had to implement dynamic loading by component path), than the warning itself
I think I’d like to do this, not for performance reasons, but to be able to use conflicting sp-elements and SWC components in the same plugin (although not in the same component).
What I’m imagining in its most basic form is a panel that has a main component that renders two child components as tabbed pages. All components share the main JS bundle, and one child component loads a secondary bundle that has the SWC components.
Where I’m confused is as how one might go about serving the secondary bundle to the plugin.
Currently I just use a <script src="bundle.js"> in my index.html file.
All that said, I’m not sure that this is the way to achieve what I’m imagining or if it’s really possible…
Webpack has settings for that. It can do both. If webpack doesn’t do chunks… it is because of settings. You could try SplitChunksPlugin | webpack and set min chunks to 2 You might also need to change entrypoints and outputs Code Splitting | webpack