Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(rsc): upgrade to react canary #10194

Merged
merged 15 commits into from
Mar 17, 2024
Prev Previous commit
Next Next commit
temp: get rsc dev passing
jtoar committed Mar 17, 2024

Verified

This commit was signed with the committer’s verified signature.
jtoar Dominic Saadi
commit 137007efbd186bb8171c3331bfd5872bbb0a4cc0
24 changes: 24 additions & 0 deletions packages/vite/src/devFeServer.ts
Original file line number Diff line number Diff line change
@@ -19,6 +19,20 @@ import { ensureProcessDirWeb } from './utils.js'
// TODO (STREAMING) Just so it doesn't error out. Not sure how to handle this.
globalThis.__REDWOOD__PRERENDER_PAGES = {}

const rscWebpackShims = `\
globalThis.__rw_module_cache__ ||= new Map();
globalThis.__webpack_chunk_load__ ||= (id) => {
console.log('rscWebpackShims chunk load id', id)
return import(id).then((m) => globalThis.__rw_module_cache__.set(id, m))
};
globalThis.__webpack_require__ ||= (id) => {
console.log('rscWebpackShims require id', id)
return globalThis.__rw_module_cache__.get(id)
};
`

async function createServer() {
ensureProcessDirWeb()

@@ -60,6 +74,16 @@ async function createServer() {
logLevel: 'info',
clearScreen: false,
appType: 'custom',
esbuild: {
banner: rscWebpackShims,
},
optimizeDeps: {
esbuildOptions: {
banner: {
js: rscWebpackShims,
},
},
},
})

// use vite's connect instance as middleware