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(compiler-sfc): removeSpecifier issue when removing initial imports (script-setup) #2729

Merged

Conversation

patak-dev
Copy link
Member

Fixes an issue with removeSpecifier in compilerScript.ts when there are several initial imports removed.

import { defineProps, defineEmit, ref } from 'vue'

was being compiled to

import { , ref } from 'vue'

Adds a test case in compileScript.spec.ts

@antfu antfu added ❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. 🐞 bug Something isn't working labels Feb 9, 2021
@@ -141,6 +141,17 @@ const myEmit = defineEmit(['foo', 'bar'])
)
})

test('should allow defineProps/Emit at the start of imports', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's better to have a comment linking to the PR/issue here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a reference to #2740, following the convention that I saw in other tests (not the full link, just the number)

@antfu antfu added this to In Review in Next Patch Feb 10, 2021
Next Patch automation moved this from In Review to Approved Feb 10, 2021
@LinusBorg LinusBorg changed the title fix(compiler-sfc): removeSpecifier issue when removing initial imports fix(compiler-sfc): removeSpecifier issue when removing initial imports (script-setup) Feb 13, 2021
@LinusBorg LinusBorg merged commit 6d762a8 into vuejs:master Feb 13, 2021
Next Patch automation moved this from Approved to Done Feb 13, 2021
@yyx990803 yyx990803 moved this from Done to Final (Reviewed by Evan) in Next Patch Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. 🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

script setup sometimes generate invalid code when using defineEmit and defineProps
4 participants