-
Notifications
You must be signed in to change notification settings - Fork 251
Description
I roughly understand that #413 aims to resolve #409, but I think it might introduce more problems.
It assumes that pkg/dist/Button.js can always originate from pkg, but the current ESM packages likely don't work that way. Taking fumadocs-ui as an example, it doesn't even have an entry point for fumadocs-ui; all exports are subpaths. In this case, this plugin will produce even more confusing errors.
Plugin: builtin:vite-resolve (x2)
9:34:04 PM [vite+] Internal server error: "." is not exported under the conditions ["module", "browser", "development", "import"] from package /Users/hyoban/f/vinext/examples/fumadocs-docs-template/node_modules/fumadocs-ui (see exports field in /Users/hyoban/f/vinext/examples/fumadocs-docs-template/node_modules/fumadocs-ui/package.json)
I tried some approaches in #577, reverse-match file path to exports. But when dealing with files not defined in exports, such as dist/layouts/docs/client.js, we can only optimize them as individual deps. I feel like doing so might be heading in the wrong direction.
I noticed that both fumadocs and waku are recommending adding deps to optimizeDeps:
I think this issue would be better addressed within @vitejs/plugin-rsc, such as in vitejs/vite-plugin-react#759 and vitejs/vite-plugin-react#775.
Please let me know if I have made any mistakes.