Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin-vue): misleading error thrown after refresh or hmr #5870

Merged
merged 2 commits into from Nov 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions packages/plugin-vue/src/utils/error.ts
Expand Up @@ -5,16 +5,22 @@ export function createRollupError(
id: string,
error: CompilerError | SyntaxError
): RollupError {
;(error as RollupError).id = id
;(error as RollupError).plugin = 'vue'
const { message, name, stack } = error
const rollupError: RollupError = {
id,
plugin: 'vue',
message,
name,
stack
}

if ('code' in error && error.loc) {
;(error as any).loc = {
rollupError.loc = {
file: id,
line: error.loc.start.line,
column: error.loc.start.column
}
}

return error as RollupError
return rollupError
}