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

Generated code with '()' caused parsing errors. #22

Closed
emosheeep opened this issue Nov 20, 2022 · 0 comments
Closed

Generated code with '()' caused parsing errors. #22

emosheeep opened this issue Nov 20, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@emosheeep
Copy link

https://github.com/sxzz/unplugin-ast/blob/fb31eeb8ca343d5b67cfa364ab5dba9812d61eaa/src/core/transform.ts#L69

I tried to return an AST node to change code content, but I found that the generated code would be wrapped with parentheses, which would cause parsing error.

e.g.

(var wrappedVar = 'test';) // Error! Unexpected token at ....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants