-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Category
- Question
- Typo
- Bug
- Additional article idea
Expected or Desired Behavior
When developing/testing using gulp serve
for large SPFx projects (more than 25 webparts and extensions), only the changed files should be built using webpack.
Observed Behavior
For large SPFx projects (including the SharePoint starter kit) where there are a large number of components, with every code change it takes about 25 seconds for webpack to build the new bundle.
This means even if we modify a single line of code, we have to wait for webpack to build the entire bundle with all the components.
I have seen this issue is mainly because SPFx adds each component by default as a separate bundle: https://github.com/SharePoint/sp-starter-kit/blob/master/solution/config/config.json
If I move all components to a single bundle, the build time is reduced considerably. But then we have the issue of having all components in a single bundle and code might be loaded on the page even if it's not needed.
Steps to Reproduce
- Clone the SP Starter Kit repo
npm install
gulp serve
- Observe that it takes about 25 secs for webpack to build the bundle
- Change a line of code in any webpart and save
- Observe that again it takes about 25 secs for webpack to build the bundle