vike-lite 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vite.mjs +5 -4
- package/package.json +1 -1
package/dist/vite.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Readable } from "node:stream";
|
|
4
4
|
import { pipeline } from "node:stream/promises";
|
|
5
|
+
import { normalizePath } from "vite";
|
|
5
6
|
//#region src/vite-plugin.ts
|
|
6
7
|
function generateRoutes(pagesAbsPath) {
|
|
7
8
|
if (!fs.existsSync(pagesAbsPath)) return { routes: [] };
|
|
@@ -189,10 +190,10 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index.ts", api
|
|
|
189
190
|
}
|
|
190
191
|
setVikeState({ routes, errorRoute, config, manifest });
|
|
191
192
|
`;
|
|
192
|
-
if (id === resolvedVirtualEntryServerId)
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
if (id === resolvedVirtualEntryServerId) {
|
|
194
|
+
const normalizedServerEntry = normalizePath(path.join(viteConfigRoot, serverEntry));
|
|
195
|
+
return `import '${virtualSetupId}';\n${fs.readFileSync(normalizedServerEntry, "utf8")}`;
|
|
196
|
+
}
|
|
196
197
|
},
|
|
197
198
|
configureServer(server) {
|
|
198
199
|
return () => {
|