Skip to content

Conversation

@hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Aug 10, 2025

Description

After #687, this should work in principle. If not, we should improve cjs module runner transform.

TODO

@hi-ogawa hi-ogawa changed the title refactor(rsc): remove server optimizeDeps.include refactor(rsc): remove server optimizeDeps.include in favor of cjs module runner transform Aug 11, 2025
@hi-ogawa
Copy link
Contributor Author

We should try ecosystem ci (Waku and react-router). If it's fine, we should go forward.

@hi-ogawa
Copy link
Contributor Author

One concern is we might want this with enforce: "pre" so that other plugin won't see require.

@hi-ogawa
Copy link
Contributor Author

Cloudflare plugin tries to optimize everything by default and it seems to cause an issue. To prevent this, users now need optimizeDeps.exclude: ["react", "react-dom"], which feels like somewhat killing the purpose of this PR.

rsc: {
optimizeDeps: {
exclude: ['react-router'],
exclude: ['react-router', 'react', 'react-dom'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unfortunate, but necessary anyways since react 3rd party libraries with potential "use client" cannot be optimized.

@hi-ogawa hi-ogawa marked this pull request as ready for review August 28, 2025 02:35
@hi-ogawa hi-ogawa marked this pull request as draft August 29, 2025 01:51
@silvenon
Copy link

silvenon commented Jan 19, 2026

Hello, I was looking for an issue/PR to track that causes my CJS module to fail during development. This is it, right?

Repro: https://github.com/silvenon/repro/tree/vite-rsc-ssr-no-external

# with GitHub CLI
gh repo clone silvenon/repro -b vite-rsc-ssr-no-external
cd repro
corepack install
pnpm install
pnpm run dev --open # fails ❌
pnpm run build
pnpm run preview --open # works ✅

At the time of creating the repro it didn't cross my mind that this could be related to CJS. But I also think that the way the problematic module is authored is faulty in its attempt at dual publish.

@hi-ogawa
Copy link
Contributor Author

hi-ogawa commented Jan 20, 2026

@silvenon Can you open an issue? This PR is a pure internal refactor and I cannot tell the direct relation. From a quick look, you have Vite beta 8 override, so is it possible that's another factor? (I've heard there are a few cjs related change due to rolldown)

@silvenon
Copy link

Done, opened #1072 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dependency resolution fails in pnpm monorepo when nodeLinker is not hoisted

3 participants