Skip to content

Commit 4b6aab3

Browse files
dominikgbenmccannbluwy
authored
docs: update FAQ entry about vite dependency pre-bundling (#158)
* docs: update FAQ entry about vite dependency pre-bundling * docs: add suggested improvements Co-authored-by: Ben McCann <[email protected]> Co-authored-by: Bjorn Lu <[email protected]> * docs: capitalize vite Co-authored-by: Ben McCann <[email protected]> Co-authored-by: Bjorn Lu <[email protected]>
1 parent a3c0634 commit 4b6aab3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

docs/faq.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,11 @@ const vitePluginCoolCss = {
9191

9292
For reference, check out [windicss](https://github.com/windicss/vite-plugin-windicss/blob/517eca0cebc879d931c6578a08accadfb112157c/packages/vite-plugin-windicss/src/index.ts#L167).
9393

94-
### What is `The requested module 'xxx' does not provide an export named 'yyy'`?
94+
### What is going on with Vite and `Pre-bundling dependencies:`?
9595

96-
This usually happens when a dependency (e.g. `xxx`) only exports CJS code, but is not optimized by Vite. It's also a common issue among many Svelte libraries because they are [excluded from optimization by default](https://github.com/vitejs/vite/issues/3910#issuecomment-897006012) by `vite-plugin-svelte`.
96+
Pre-bundling dependencies is an [optimization in Vite](https://vitejs.dev/guide/dep-pre-bundling.html).
97+
It is required for CJS dependencies, as Vite's development server only works with ES modules on the client side.
9798

98-
A pending [Vite pull request](https://github.com/vitejs/vite/pull/4634) would help solve this issue soon, but until then, try contacting the `xxx` library authors to also export ESM code.
99+
Thanks to [a new API in Vite](https://github.com/vitejs/vite/pull/4634), [vite-plugin-svelte](https://github.com/sveltejs/vite-plugin-svelte/pull/157) automatically handles pre-bundling these for you.
100+
101+
In case you still run into errors like `The requested module 'xxx' does not provide an export named 'yyy'`, please check our [open issues](https://github.com/sveltejs/vite-plugin-svelte/issues).

0 commit comments

Comments
 (0)