Skip to content

Commit

Permalink
RSC: Externalize more modules during build (#10753)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Jun 8, 2024
1 parent 9faa582 commit ed75ed8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/vite/src/rsc/rscBuildAnalyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,17 @@ export async function rscBuildAnalyze() {
// going to be RSCs
// As of vite 5.2 `true` here means "all except node built-ins"
noExternal: true,
// TODO (RSC): Figure out what the `external` list should be. Right
// now it's just copied from waku, plus we added prisma
external: ['react', 'minimatch', '@prisma/client'],
// Anything we know won't have "use client" or "use server" in it can
// safely be external. The more we can externalize the better, because
// it means we can skip analyzing them, which means faster build times.
external: [
'react',
'minimatch',
'@prisma/client',
'@prisma/fetch-engine',
'@prisma/internals',
'playwright',
],
resolve: {
externalConditions: ['react-server'],
},
Expand Down
7 changes: 7 additions & 0 deletions packages/vite/src/rsc/rscBuildForSsr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ export async function rscBuildForSsr({
// Files included in `noExternal` are files we want Vite to analyze
// As of vite 5.2 `true` here means "all except node built-ins"
noExternal: true,
external: [
'minimatch',
'@prisma/client',
'@prisma/fetch-engine',
'@prisma/internals',
'playwright',
],
},
plugins: [
cjsInterop({ dependencies: ['@redwoodjs/**'] }),
Expand Down

0 comments on commit ed75ed8

Please sign in to comment.