You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: move lazy loading docs to config troubleshooting page
Use Vite's native Promise-based plugin support via dynamic import()
instead of the custom lazy field. Migrate the documentation from
config/index.md to a new config/troubleshooting.md page and update
the snap test to use the import().then() pattern.
Copy file name to clipboardExpand all lines: docs/config/index.md
+1-64Lines changed: 1 addition & 64 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,67 +28,4 @@ Vite+ extends the basic Vite configuration with these additions:
28
28
-[`test`](/config/test) for Vitest
29
29
-[`run`](/config/run) for Vite Task
30
30
-[`pack`](/config/pack) for tsdown
31
-
-[`staged`](/config/staged) for staged-file checks
32
-
33
-
## Lazy Loading Plugins
34
-
35
-
When `vite.config.ts` imports heavy plugins at the top level, every `import` is evaluated eagerly, even for commands like `vp lint` or `vp fmt` that don't need those plugins. This can make config loading noticeably slow.
36
-
37
-
The `lazy` field solves this by letting you defer plugin loading into an async function. Plugins provided through `lazy` are only resolved when actually needed:
Plugins returned from `lazy` are appended after any plugins already in the `plugins` array. This lets you keep lightweight plugins inline and defer only the expensive ones:
Use this page when your Vite+ configuration is not behaving the way you expect.
4
+
5
+
## Slow config loading caused by heavy plugins
6
+
7
+
When `vite.config.ts` imports heavy plugins at the top level, every `import` is evaluated eagerly, even for commands like `vp lint` or `vp fmt` that don't need those plugins. This can make config loading noticeably slow.
8
+
9
+
Vite supports promises in the `plugins` array, so you can use dynamic `import()` to defer heavy plugin loading:
0 commit comments