Skip to content

Commit 88d362c

Browse files
authored
fix: can't resolve vue template compiler (#57)
1 parent 712b905 commit 88d362c

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/utils.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ declare module '@vue/compiler-sfc' {
2020
}
2121
}
2222

23-
const __dirname = path.dirname(new URL(import.meta.url).pathname)
2423
const debug = createDebug('@intlify/cli:utils')
2524

2625
export type CustomBlockContentType = 'json' | 'json5' | 'yaml' | 'unknwon'
@@ -287,15 +286,12 @@ export async function getSFCParser(version: number): Promise<parseSFC | null> {
287286
let parser: parseSFC | null = null
288287
try {
289288
if (version === 3) {
290-
parser = (
291-
await import(
292-
path.resolve(__dirname, '../node_modules', '@vue/compiler-sfc')
293-
).then(_rDefault)
294-
).parse as parseSFC
289+
parser = (await import('@vue/compiler-sfc').then(_rDefault))
290+
.parse as parseSFC
295291
} else if (version === 2) {
296-
const { parseComponent } = await import(
297-
path.resolve(__dirname, '../node_modules', 'vue-template-compiler')
298-
).then(_rDefault)
292+
const { parseComponent } = await import('vue-template-compiler').then(
293+
_rDefault
294+
)
299295
parser = (source: string) => {
300296
const errors: SyntaxError[] = []
301297
const descriptor = parseComponent(source)

0 commit comments

Comments
 (0)