refactor(rsc): remove server optimizeDeps.include in favor of cjs module runner transform#692
refactor(rsc): remove server optimizeDeps.include in favor of cjs module runner transform#692
optimizeDeps.include in favor of cjs module runner transform#692Conversation
This reverts commit 238e832.
optimizeDeps.include in favor of cjs module runner transform
…into 08-11-refactor_rsc_remove_server_optimizedeps.include
|
We should try ecosystem ci (Waku and react-router). If it's fine, we should go forward. |
|
One concern is we might want this with |
|
Cloudflare plugin tries to optimize everything by default and it seems to cause an issue. To prevent this, users now need |
| rsc: { | ||
| optimizeDeps: { | ||
| exclude: ['react-router'], | ||
| exclude: ['react-router', 'react', 'react-dom'], |
There was a problem hiding this comment.
This is unfortunate, but necessary anyways since react 3rd party libraries with potential "use client" cannot be optimized.
|
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. |
|
@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) |
|
Done, opened #1072 👍 |
Description
After #687, this should work in principle. If not, we should improve cjs module runner transform.
TODO
defaultimport interop fix(rsc): fix cjs default import on module runner #695test-provider-in-server-depinpackages/plugin-rsc/examples/basic/src/routes/deps/client-in-server/server.tsxis broken. it looks like dual module of@vitejs/test-dep-client-in-server2/client.?v=won't be added to anymore, which breaksclient-in-server-package-proxydetection logic.isInNodeModuleinstead of?v=fix(rsc): replace?v=check with more robustnode_modulesdetection #696