File tree Expand file tree Collapse file tree
packages/plugin-vite/src/plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,11 @@ import {
1414 specToName ,
1515 UniqueNamer ,
1616} from "fresh/internal-dev" ;
17- import { pathWithRoot , type ResolvedFreshViteConfig } from "../utils.ts" ;
17+ import {
18+ JS_REG ,
19+ pathWithRoot ,
20+ type ResolvedFreshViteConfig ,
21+ } from "../utils.ts" ;
1822import * as path from "@std/path" ;
1923import { getBuildId } from "./build_id.ts" ;
2024
@@ -268,7 +272,12 @@ export function serverSnapshot(options: ResolvedFreshViteConfig): Plugin[] {
268272 name : "fresh:island-resolver" ,
269273 resolveId ( id ) {
270274 if ( id . startsWith ( "fresh-island::" ) ) {
271- const name = id . slice ( "fresh-island::" . length ) ;
275+ let name = id . slice ( "fresh-island::" . length ) ;
276+
277+ if ( JS_REG . test ( name ) ) {
278+ name = name . slice ( 0 , name . lastIndexOf ( "." ) ) ;
279+ }
280+
272281 const spec = islandSpecByName . get ( name ) ;
273282 if ( spec !== undefined ) return spec ;
274283 }
You can’t perform that action at this time.
0 commit comments