Skip to content

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
)
})

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)

@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
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