Skip to content

Commit cedb411

Browse files
committed
fix: absoluate path resolve
1 parent d93f90c commit cedb411

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/context.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ export class Context {
9999
}
100100

101101
relative(path: string) {
102+
if (path.startsWith('/') && !path.startsWith(this.root))
103+
return path.slice(1).replace(/\\/g, '/')
102104
return relative(this.root, path).replace(/\\/g, '/')
103105
}
104106

test/fixture/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createApp } from 'vue'
2-
import App from './App.vue'
2+
import App from '/src/App.vue'
33
import './index.css'
44

55
createApp(App).mount('#app')

0 commit comments

Comments
 (0)