Skip to content

Commit 5c07cec

Browse files
y1d7ngantfu
andauthored
fix(plugin-vue): misleading error thrown after refresh or hmr (#5870)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
1 parent f1b8b5f commit 5c07cec

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

packages/plugin-vue/src/utils/error.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@ export function createRollupError(
55
id: string,
66
error: CompilerError | SyntaxError
77
): RollupError {
8-
;(error as RollupError).id = id
9-
;(error as RollupError).plugin = 'vue'
8+
const { message, name, stack } = error
9+
const rollupError: RollupError = {
10+
id,
11+
plugin: 'vue',
12+
message,
13+
name,
14+
stack
15+
}
1016

1117
if ('code' in error && error.loc) {
12-
;(error as any).loc = {
18+
rollupError.loc = {
1319
file: id,
1420
line: error.loc.start.line,
1521
column: error.loc.start.column
1622
}
1723
}
1824

19-
return error as RollupError
25+
return rollupError
2026
}

0 commit comments

Comments
 (0)