Skip to content

Commit

Permalink
fix(rsc): only use web/src/entries.ts as the rscBuildAnalyze entr…
Browse files Browse the repository at this point in the history
…y point (#10218)

Right now `rscBuildAnalyze` scans three entry points and ~1600 files for
`'use client'` and `'use server'` directives.

```js
{
  entries: "~/redwood-app/web/src/entries.ts",
  "entry.server": "~/redwood-app/web/src/entry.server.tsx",
  Document: "~/redwood-app/web/src/Document.tsx",
}
```

Checked with @Tobbe and the only entry point we actually need to scan is
`web/src/entries.ts`. With this change, we only scan 267 files.
  • Loading branch information
jtoar authored Mar 14, 2024
1 parent 81d19cd commit 23a9fac
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions packages/vite/src/rsc/rscBuildAnalyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,16 @@ export async function rscBuildAnalyze() {
build: {
manifest: 'rsc-build-manifest.json',
write: false,
ssr: true,
// TODO (RSC): In the future we want to generate the entries file
// automatically. Maybe by using `analyzeRoutes()`
// For the dev server we might need to generate these entries on the
// fly - so we will need something like a plugin or virtual module
// to generate these entries, rather than write to actual file.
// And so, we might as well use on-the-fly generation for regular
// builds too
ssr: rwPaths.web.entries,
rollupOptions: {
onwarn: onWarn,
input: {
// TODO (RSC): In the future we want to generate the entries file
// automatically. Maybe by using `analyzeRoutes()`
// For the dev server we might need to generate these entries on the
// fly - so we will need something like a plugin or virtual module
// to generate these entries, rather than write to actual file.
// And so, we might as well use on-the-fly generation for regular
// builds too
entries: rwPaths.web.entries,
},
},
},
})
Expand Down

0 comments on commit 23a9fac

Please sign in to comment.