File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 1
1
import path from "node:path" ;
2
- import type { PluginOption , ResolvedConfig } from "vite" ;
2
+ import { normalizePath , type PluginOption , type ResolvedConfig } from "vite" ;
3
3
import createCache from "./cache" ;
4
4
import { genComponentBlockCode , genExportsCode } from "./gen" ;
5
5
import { parseVueRequest , pascalCase } from "./utils" ;
@@ -23,12 +23,17 @@ export default function vueNestedSFC(): PluginOption {
23
23
if ( cache . isNestedComponent ( id ) ) {
24
24
return id ;
25
25
}
26
- if ( importerFile && cache . isNestedComponent ( importerFile ) ) {
27
- let [ , importerDir ] = importerFile . match ( / ^ ( .* ) (?: \/ [ ^ / ] + ) { 2 } \. v u e $ / ) ! ;
26
+
27
+ const request = importerFile && parseVueRequest ( importerFile ) ;
28
+
29
+ if ( request && cache . isNestedComponent ( request . filename ) ) {
30
+ let [ , importerDir ] = request . filename . match (
31
+ / ^ ( .* ) (?: \/ [ ^ / ] + ) { 2 } \. v u e $ /
32
+ ) ! ;
28
33
if ( ! importerDir . startsWith ( config . root ) ) {
29
34
importerDir = config . root + importerDir ;
30
35
}
31
- return path . resolve ( importerDir , id ) ;
36
+ return normalizePath ( path . resolve ( importerDir , id ) ) ;
32
37
}
33
38
} ,
34
39
You can’t perform that action at this time.
0 commit comments