Skip to content

feat(compiler-core): export error message #8729

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

Merged
merged 2 commits into from
Sep 5, 2023

Conversation

shengxinjing
Copy link
Contributor

@shengxinjing shengxinjing commented Jul 5, 2023

#4537

The dev environment has a more friendly error message when compiling a template that reports an error. But the prod environment has only one error code

SyntaxError: Element is missing end tag.  # dev
SyntaxError: 24  #prod

we can add error-messages export for better production bug and error report

import {errorMessages, DOMErrorMessages} from '@vue/compiler-dom'

const errorLogProd = 'SyntaxError: 24'
const code = errorLogProd.split(':')[1].trim()
const message = errorMessages[code] || DOMErrorMessages[code]
sendErrorReport(message ...) // Invalid end tag.
...

@sxzz sxzz changed the title fix: export errorMessage in compiler-core and dom for better prod debug feat(compiler-core): export error message Aug 31, 2023
@sxzz sxzz force-pushed the export-error-message-compilercore branch from 5f48c93 to 57310a3 Compare August 31, 2023 08:10
@github-actions
Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 85.8 kB 32.6 kB 29.5 kB
vue.global.prod.js 132 kB 49.3 kB 44.3 kB

Usages

Name Size Gzip Brotli
createApp 47.9 kB 18.8 kB 17.2 kB
createSSRApp 50.6 kB 19.9 kB 18.2 kB
defineCustomElement 50.3 kB 19.6 kB 17.9 kB
overall 61.2 kB 23.7 kB 21.6 kB

Copy link
Member

@sxzz sxzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in code perspective, but we need more discussion

@sxzz
Copy link
Member

sxzz commented Aug 31, 2023

Looks like the bundle size didn't increase. It's tree-shakable. I think the PR is acceptable.

@sxzz sxzz added ready to merge The PR is ready to be merged. scope: compiler labels Aug 31, 2023
@sxzz sxzz changed the base branch from main to 3.4 September 5, 2023 07:46
@sxzz sxzz merged commit 184ed40 into vuejs:3.4 Sep 5, 2023
sxzz pushed a commit that referenced this pull request Sep 5, 2023
@sxzz sxzz mentioned this pull request Sep 5, 2023
sxzz pushed a commit that referenced this pull request Sep 21, 2023
sxzz pushed a commit that referenced this pull request Sep 22, 2023
sxzz pushed a commit that referenced this pull request Oct 14, 2023
johnsoncodehk added a commit to johnsoncodehk/core that referenced this pull request Oct 14, 2023
sxzz pushed a commit that referenced this pull request Oct 18, 2023
sxzz pushed a commit that referenced this pull request Oct 19, 2023
baiwusanyu-c pushed a commit to baiwusanyu-c/bwsy-vue-core that referenced this pull request Oct 20, 2023
sxzz pushed a commit that referenced this pull request Oct 20, 2023
sxzz pushed a commit that referenced this pull request Oct 23, 2023
sxzz pushed a commit that referenced this pull request Oct 27, 2023
sxzz pushed a commit to baiwusanyu-c/bwsy-vue-core that referenced this pull request Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants