fix: module excution

This commit is contained in:
Anthony Fu 2021-12-15 14:54:06 +08:00
parent d2c8cf06b6
commit 6995c506f0
2 changed files with 5 additions and 1 deletions

View File

@ -94,7 +94,7 @@ export async function executeInViteNode(options: ExecuteOptions) {
return stubRequests[id]
const transformed = await fetch(id)
if (!transformed)
if (transformed == null)
throw new Error(`failed to load ${id}`)
// disambiguate the `<UNIT>:/` on windows: see nodejs/node#31710

View File

@ -178,6 +178,10 @@ export function posToNumber(
const lines = source.split(splitRE)
const { line, column } = pos
let start = 0
if (line > lines.length)
return source.length
for (let i = 0; i < line - 1; i++)
start += lines[i].length + 1