Skip to content

Conversation

@hi-ogawa
Copy link
Owner

@hi-ogawa hi-ogawa commented Jun 27, 2025

For now, don't try to introduce @vercel/nft and aim for one-to-one port.

Copy link
Owner Author

hi-ogawa commented Jun 27, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@hi-ogawa hi-ogawa force-pushed the 06-27-feat_deployment_adapters branch from 28f1d0d to 6f6f452 Compare June 27, 2025 03:08
@hi-ogawa hi-ogawa force-pushed the 06-27-feat_deployment_adapters branch from 4dff8ef to 3943b3d Compare June 27, 2025 05:14
@hi-ogawa hi-ogawa marked this pull request as ready for review June 27, 2025 06:39
@hi-ogawa hi-ogawa mentioned this pull request Jun 27, 2025
@hi-ogawa hi-ogawa merged commit 80fdab7 into chore-vite-rsc Jun 27, 2025
7 of 10 checks passed
@hi-ogawa hi-ogawa deleted the 06-27-feat_deployment_adapters branch June 27, 2025 06:47
dai-shi pushed a commit to wakujs/waku that referenced this pull request Aug 3, 2025
(EDIT: see also blog post for the summary
#1564)

This PR replaces Waku's `vite` and `react-server-dom-webpack` internals
with `@vitejs/plugin-rsc`.

The new code path is split in `waku/src/vite-rsc/...` but Waku's core
routing logic is reused internally. Previously implementation is still
preserved and can be enabled via a flag `--experimental-legacy-cli` e.g.

```sh
pnpm -C examples/01_template dev --experimental-legacy-cli
```

The goal is to achieve the switch with as little breaking change as
possible. There are still missing pieces as I wrote in todo at the
bottom, but the overall shape is mostly established, so I'm opening a PR
here to start to gather feedback. Thanks!

## known changes

- new `{ vite: ... }` config in `waku.config.ts`
- this replaces custom `vite.config.ts` and `unstable_viteConfigs` in
`waku.config.ts`
- custom plugin can access environment API configuration and plugin
system
    - https://vite.dev/guide/api-environment.html
    - https://vite.dev/guide/api-environment-plugins.html

```js
// waku.config.ts
import { defineConfig } from "waku/config"

export default defineConfig({
  vite: {
    plugins: [ ... ],
    environments: {
      client: { ... },
      ssr: { ... },
      rsc: { ... },
    }
  }
})
```

- `ssr` environment (previously "main server ssr") doesn't externalize
server deps by default, but transform all react deps.
- This means if there's cjs dependency (directly or transitively) used
in client component, SSR might fail during dev. For example, `swr` (esm)
package uses `use-sync-external-store` (cjs) internally. This can be
mitigated by `environments.ssr.optimizeDeps.include: ["swr"]`.
  - See also vitejs/vite-plugin-react#610

## e2e status

Run it locally e.g. by

```js
TEST_VITE_RSC=1 pnpm exec playwright test --project=chromium-dev e2e/rsc-basic.spec.ts
pnpm -C e2e/fixtures/rsc-basic dev --experimental-vite-rsc
```

- [x] broken-links
- [x] create-pages
- [x] define-router
- [x] fs-router
- [x] hot-reload
- [x] monorepo
- [x] multi-platform
- [x] partial-build
- [x] render-type
- [x] rsc-asset
- [x] rsc-basic
- [x] rsc-css-modules
- [x] ssg-performance
- [x] ssg-wildcard
- [x] ssr-basic
- [x] ssr-catch-error
- [x] ssr-context-provider
- [x] ssr-redirect
- [x] ssr-swr
- [x] ssr-target-bundle
- [x] use-router
- [x] examples-smoke
  - [x] 11_fs-router (build)
  - [x] 12_nossr (build)
  - [x] 36_form (see #1534)
  - [x] 38_cookies (build)
  - [x] website

## todo 

- [x] test: `waitForHydration` or not?
#1493 (comment)
- [x] reduce diff
- [ ] announcement #1564
- [ ] discuss dependency structure (dep vs peer-dep,
`@hiogawa/vite-plugin` or wait for it to move to vitejs org)
- [ ] replace completely hi-ogawa#20
- [x] test: fix windows ci fail
hi-ogawa#11
- [x] deployment adapter hi-ogawa#8
  - vercel example https://waku-vite-rsc-01-template.vercel.app
- [x] "use client" transform with `allowServer`
hi-ogawa/vite-plugins#1078
- [x] improve waku.config support
hi-ogawa#5
- [x] polish middleware hi-ogawa#7
- [x] integrate hono hi-ogawa#6
- [ ] check if any known issues will be fixed by this change. (if it's
still not working, check if it's also reproduce with
https://github.com/hi-ogawa/vite-plugins/tree/main/packages/rsc and
raise it as an upstream issue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants