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: multivariable declaration parsing error #250

Merged
merged 4 commits into from
Jun 26, 2023

Conversation

jaw52
Copy link
Contributor

@jaw52 jaw52 commented Jun 19, 2023

Regular expression parsing fails when multiple variables are declared in a single line in JavaScript

for example

const a = 1, ref = 2

Afterunimport processing, resulting in repeated import

+ import {ref} from 'vue'
const a = 1, ref = 2

close #223

@antfu antfu merged commit 8f50633 into unjs:main Jun 26, 2023
@jaw52 jaw52 deleted the fix/multivariable_declaration_parsing branch June 27, 2023 01:14
antfu added a commit that referenced this pull request Jun 28, 2023
@antfu
Copy link
Member

antfu commented Jun 28, 2023

As RegExp is not turning complete, it's not possible to handle all the cases. This PR introduces other regressions nuxt/nuxt#21807 that I see are more commonly used. We need to make a trade-off here. I have reverted this change until we find better solutions, otherwise, I guess we would need to document what's the caveats are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Identifier already declared error
2 participants