Skip to content

Commit 3523a6a

Browse files
committed
fix: remove protocol
1 parent 0b8bdaa commit 3523a6a

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

packages/vite-node/src/externalize.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,14 @@ async function isValidNodeImport(id: string, code?: string) {
7272
if (package_.type === 'module')
7373
return true
7474

75-
if (typeof code === 'undefined')
76-
code = await fsp.readFile(id, 'utf8').catch(() => '')
75+
if (typeof code === 'undefined') {
76+
code = await fsp.readFile(id.replace('file:///', ''), 'utf8').catch((err) => {
77+
// FIXME: test
78+
// eslint-disable-next-line no-console
79+
console.log('Failed to read file:', id, err)
80+
return ''
81+
})
82+
}
7783

7884
return !ESM_SYNTAX_RE.test(code)
7985
}

0 commit comments

Comments
 (0)