cloudflare / cloudflare/vinext
Remove clientReferenceDedupPlugin
- Dominant language
- TypeScript
- Stars
- 8.8k
- Forks
- 406
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 120
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`:
https://github.com/fuma-nama/fumadocs/blob/aa7e96a46521f2e7953e094eaa19f49c3cf7540f/examples/waku/waku.config.ts#L10-L16
https://github.com/wakujs/waku/blob/da6fbb4f83fb0eed12188a4a53b29c230275af9c/examples/42_react-tweet/waku.config.ts#L7-L10
I think this issue would be better addressed within `@vitejs/plugin-rsc`, such as in https://github.com/vitejs/vite-plugin-react/issues/759 and https://github.com/vitejs/vite-plugin-react/issues/775.
Please let me know if I have made any mistakes.
Contributor guide
Assessment
This issue has not been assessed yet.