Skip to content

Commit 8f4e272

Browse files
committed
fix: make vite CSS hmr and auto load work in fs routes
1 parent 0d4a608 commit 8f4e272

1 file changed

Lines changed: 3 additions & 16 deletions

File tree

  • packages/start/src/config/fs-routes

packages/start/src/config/fs-routes/index.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { relative, resolve } from "node:path";
2-
import { normalizePath, type PluginOption } from "vite";
1+
import { relative } from "node:path";
2+
import { type PluginOption } from "vite";
33

4-
import { VITE_ENVIRONMENTS } from "../constants.ts";
54
import { fileSystemWatcher } from "./fs-watcher.ts";
65
import type { BaseFileSystemRouter } from "./router.ts";
76
import { treeShake } from "./tree-shake.ts";
@@ -59,10 +58,7 @@ export function fsRoutes({ routers }: FsRoutesArgs): Array<PluginOption> {
5958
build: isBuild
6059
? `_$() => import(/* @vite-ignore */ '${buildId}')$_`
6160
: undefined,
62-
import:
63-
this.environment.name === VITE_ENVIRONMENTS.server
64-
? `_$() => import(/* @vite-ignore */ '${buildId}')$_`
65-
: `_$(() => clientManifestImport('${relative(root, buildId)}'))$_`,
61+
import: `_$() => import(/* @vite-ignore */ '${buildId}')$_`
6662
};
6763
}
6864
return v;
@@ -72,15 +68,6 @@ export function fsRoutes({ routers }: FsRoutesArgs): Array<PluginOption> {
7268

7369
const code = `
7470
${js.getImportStatements()}
75-
${
76-
this.environment.name === VITE_ENVIRONMENTS.server
77-
? ""
78-
: `
79-
import { getClientManifest } from "solid-start:get-client-manifest";
80-
function clientManifestImport(id) {
81-
return getClientManifest().import(id)
82-
}`
83-
}
8471
export default ${routesCode}`;
8572
return code;
8673
},

0 commit comments

Comments
 (0)