Skip to content

Commit

Permalink
add effect packages into the optimized-by-default list (#65465)
Browse files Browse the repository at this point in the history
### What?

Adding packages from the Effect ecosystem to the list of
optimized-by-default imports

### Why?

Effect usage includes very liberal use of `import * as Module from
"effect/Module"` and `import { Module } from "effect"`. This is usually
trees-shaken but in nextjs we must declare it to be optimized to be have
this way. To provide a better experience to users I added all the
packages in the ecosystem to the list that are possibly relevant. I
don't expect all of them to get in, but the proposal should start from
the full set of possible candidates. Not included are `/cli`,
`/printer`, `/printer-ansi`, and `/vitest`.

At the very least `effect` and `/schema` should be added for their
prevalence, but even if there is hesitance I recommend adding
`/platform` and `/platform-node` since it's natural for effect usage to
grow into benefitting from these quickly enough.

Related issue in the effect repo 
Effect-TS/effect#2701

cited source for taken action:
[the vercel
blog](https://vercel.com/blog/how-we-optimized-package-imports-in-next-js)

### How?

Adding strings to a set

Co-authored-by: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
datner and ijjk committed May 16, 2024
1 parent d14f9ce commit 9f647f3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/next/src/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,26 @@ function assignDefaults(
'@mui/icons-material',
'recharts',
'react-use',
'effect',
'@effect/schema',
'@effect/platform',
'@effect/platform-node',
'@effect/platform-browser',
'@effect/platform-bun',
'@effect/sql',
'@effect/sql-mssql',
'@effect/sql-mysql2',
'@effect/sql-pg',
'@effect/sql-squlite-node',
'@effect/sql-squlite-bun',
'@effect/sql-squlite-wasm',
'@effect/sql-squlite-react-native',
'@effect/sql-squlite-wasm',
'@effect/rpc',
'@effect/rpc-http',
'@effect/typeclass',
'@effect/experimental',
'@effect/opentelemetry',
'@material-ui/core',
'@material-ui/icons',
'@tabler/icons-react',
Expand Down

0 comments on commit 9f647f3

Please sign in to comment.