Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(viteroll): test vite rolldown dev #74

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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 viteroll/examples/mpa/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h1>Home</h1>
<li><a href="/about">About</a></li>
</ul>
<div id="root"></div>
<script src="./index.js"></script>
<script type="module" src="./index.js"></script>
</div>
</body>
</html>
7 changes: 5 additions & 2 deletions viteroll/examples/mpa/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from "vite";
import { viteroll } from "../../viteroll";
// import { viteroll } from "../../viteroll";

export default defineConfig({
root: "./src",
Expand All @@ -15,5 +15,8 @@ export default defineConfig({
},
},
},
plugins: [viteroll()],
experimental: {
rolldownDev: { hmr: true, reactRefresh: true },
},
// plugins: [viteroll()],
});
3 changes: 1 addition & 2 deletions viteroll/examples/react/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script src="./src/main.tsx"></script>
<script type="module" src="./src/main.tsx"></script>
</body>
</html>
11 changes: 7 additions & 4 deletions viteroll/examples/react/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { defineConfig } from "vite";
import { viteroll } from "../../viteroll";
// import { viteroll } from "../../viteroll";

export default defineConfig({
experimental: {
rolldownDev: { hmr: true, reactRefresh: true },
},
plugins: [
viteroll({
reactRefresh: true,
}),
// viteroll({
// reactRefresh: true,
// }),
],
});
16 changes: 10 additions & 6 deletions viteroll/examples/ssr/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from "vite";
import { RolldownEnvironment, viteroll } from "../../viteroll";
// import { RolldownEnvironment, viteroll } from "../../viteroll";

process.setSourceMapsEnabled(true);

Expand All @@ -24,10 +24,13 @@ export default defineConfig({
},
},
},
experimental: {
rolldownDev: { hmr: true, reactRefresh: true },
},
plugins: [
viteroll({
reactRefresh: true,
}),
// viteroll({
// reactRefresh: true,
// }),
{
name: "ssr-middleware",
config() {
Expand All @@ -37,10 +40,11 @@ export default defineConfig({
},
configureServer(server) {
return () => {
const devEnv = server.environments.ssr as RolldownEnvironment;
server.middlewares.use(async (req, res, next) => {
try {
const mod = (await devEnv.import("index")) as any;
const mod = (await (server.environments.ssr as any).import(
"index",
)) as any;
await mod.default(req, res);
} catch (e) {
next(e);
Expand Down
2 changes: 1 addition & 1 deletion viteroll/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"preact": "^10.24.3",
"rolldown": "0.13.2-snapshot-a292401-20241105072341",
"typescript": "^5.6.3",
"vite": "6.0.0-beta.8"
"vite": "./vite-6.0.0-beta.8.tgz"
},
"peerDependencies": {
"rolldown": "*",
Expand Down
19 changes: 13 additions & 6 deletions viteroll/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added viteroll/vite-6.0.0-beta.8.tgz
Binary file not shown.
7 changes: 5 additions & 2 deletions viteroll/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as rolldown from "rolldown";
import { type Plugin, defineConfig } from "vite";
import { viteroll } from "./viteroll";
// import { viteroll } from "./viteroll";

export default defineConfig({
clearScreen: false,
Expand All @@ -10,8 +10,11 @@ export default defineConfig({
resolve: {
alias: {},
},
experimental: {
rolldownDev: { hmr: true },
},
plugins: [
viteroll(),
// viteroll(),
{
name: "test-virtual",
resolveId: {
Expand Down