-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(compiler-sfc): allow export default substring #7041
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider this example:
export const foo = default_
Let's check if the brackets ({}
) exist.
export { foo as default }
Questions:
FYI I wrote a regexp: UPDATED regex |
For the case without |
@btea Oh, thanks! I just remembered. |
I just updated the regexp, maybe you can try it. |
It looks great, but the |
I tried it but it fails in these cases core/packages/compiler-sfc/__tests__/rewriteDefault.spec.ts Lines 18 to 33 in 7663a79
|
@btea I think it's very hard to check it by regex, I think we could do it by AST. I trying to implement it. |
Hi gays! This new regexp ((^|\n|;)\sexport\s{.(\s[\w_$]+\s+as\s+)?default) could give false positive on a line like this one: |
@klyuevtech |
@sxzz This one seems works well: |
@klyuevtech core/packages/compiler-sfc/__tests__/rewriteDefault.spec.ts Lines 112 to 115 in 7663a79
|
😮💨 I think it's too complex, even if we have a perfect regex. |
AST based approach handles default in comments and strings, I think works better in all cases. Closing in favour of #7068. |
…f regex (vuejs#7068) closes vuejs#7038 closes vuejs#7041 closes vuejs#7078
fix #7038