Skip to content

Remove clientReferenceDedupPlugin #581

@hyoban

Description

@hyoban

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 vitejs/vite-plugin-react#759 and vitejs/vite-plugin-react#775.

Please let me know if I have made any mistakes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions