-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Category
- Question
- Typo
- Bug
- Additional article idea
I wrote a post about loading resources from within the asset bundle (script, react components) only needed in edit mode at
https://www.techmikael.com/2018/08/an-adventure-into-optimizing-sharepoint.html
This could also be dynamic components loaded in any UI mode.
Right now we need to resort to custom gulp tasks to add files to be included into the .sppkg file, and getting the script URL where the bundle is served from is tricky. Pre v1.5 we could get it via context.manifests
etc, but those properties have been «hidden» in v1.5. Which is why I decided to use a dummy image instead to go the supported route.
Ideally we would be able to reference scripts via the externals
config section, and decide if the script is loaded automatically at runtime, or dynamically via SPComponentLoader. This would make it far easier to create runtime optimized web parts and extensions, loading and bootstrapping as little .js as possible per page, and load more as needed in the life cycle of the page. Having larger .js files loaded later is often more beneficial compared to loading large bundles up front.
I have employed this pattern to the modern script editor web part and to the react search refiner sample so far. Greatly reducing initial loading and bootstrapping.
Thoughts or comments around this?