-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrepro-v5.js
40 lines (38 loc) · 933 Bytes
/
repro-v5.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { createServer } from "vite";
async function main() {
const server = await createServer({
configFile: false,
clearScreen: false,
optimizeDeps: {
// client pre-bundle seems to hide the issue sometimes
noDiscovery: true,
include: [],
},
ssr: {
target: "webworker",
noExternal: true,
resolve: {
conditions: ["worker"],
},
},
plugins: [
{
name: "repro",
configureServer(server) {
server.middlewares.use(async (req, res, next) => {
const url = new URL(req.url ?? "", "http://dev.local");
if (url.pathname === "/ssr") {
const mod = await server.ssrLoadModule("/src/entry");
res.end(`ssr: ${mod.default}`);
return;
}
next();
});
},
},
],
});
await server.listen();
server.printUrls();
}
main();