Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"tsup": "^8.1.0",
"tsx": "^4.16.2",
"typescript": "^5.5.4",
"vite": "^6.1.0",
"vite": "https://pkg.pr.new/rolldown/vite@7e5a8b6",
"vitest": "^3.0.3",
"wrangler": "^3.79.0"
},
Expand Down
1 change: 1 addition & 0 deletions packages/react-server-next/src/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ function nextJsxPlugin(): Plugin {
config: () => ({
esbuild: { jsx: "automatic" },
optimizeDeps: {
// TODO: what's the equivalent on oxc?
esbuildOptions: { jsx: "automatic", loader: { ".js": "jsx" } },
},
}),
Expand Down
16 changes: 16 additions & 0 deletions packages/react-server/examples/basic/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ export default defineConfig({
buildMode: process.env.VERCEL || process.env.CF_PAGES ? "import" : "fs",
}),
]),
{
// external require polyfill prevents adapter-level bundling,
// but since rolldown is fast, we can simply go `noExternal: true`.
// cf. https://github.com/hi-ogawa/reproductions/tree/main/rolldown-vite-require-react-polyfill
name: "avoid-require-polyfill",
apply: "build",
configEnvironment(name) {
if (name === "ssr") {
return {
resolve: {
noExternal: true,
},
};
}
},
},
],
build: {
ssrEmitAssets: true,
Expand Down
23 changes: 23 additions & 0 deletions packages/react-server/vitest.config.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { transformWithEsbuild } from "vite";
import { defineConfig } from "vitest/config";

export default defineConfig({
Expand All @@ -12,4 +13,26 @@ export default defineConfig({
fileParallelism: false,
watch: false,
},
plugins: [
{
// OXC doesn't support `using` yet
// https://github.com/oxc-project/oxc/issues/9168
name: "esbuild-transform",
async transform(code, id, _options) {
if (id.endsWith(".ts") && code.includes("using")) {
const result = await transformWithEsbuild(code, id, {
sourcemap: true,
supported: {
using: false,
},
});
return {
code: result.code,
map: result.map,
};
}
return;
},
},
],
});
Loading