Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b0400f3

Browse filesBrowse files
authored
fix(vue): import with query (#592)
1 parent 5f43900 commit b0400f3
Copy full SHA for b0400f3

File tree

Expand file treeCollapse file tree

4 files changed

+22
-2
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+22
-2
lines changed

‎packages/plugin-vue/src/index.ts

Copy file name to clipboardExpand all lines: packages/plugin-vue/src/index.ts
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import type {
99
} from 'vue/compiler-sfc'
1010
import type * as _compiler from 'vue/compiler-sfc'
1111
import { computed, shallowRef } from 'vue'
12-
import { exactRegex } from '@rolldown/pluginutils'
12+
import {
13+
exactRegex,
14+
makeIdFiltersToMatchWithQuery,
15+
} from '@rolldown/pluginutils'
1316
import { version } from '../package.json'
1417
import { resolveCompiler } from './compiler'
1518
import { parseVueRequest } from './utils/query'
@@ -358,7 +361,10 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
358361
optionsHookIsCalled = true
359362
;(plugin.transform as TransformObjectHook).filter = {
360363
id: {
361-
include: [...ensureArray(include.value), /[?&]vue\b/],
364+
include: [
365+
...makeIdFiltersToMatchWithQuery(ensureArray(include.value)),
366+
/[?&]vue\b/,
367+
],
362368
exclude: exclude.value,
363369
},
364370
}

‎playground/vue/Main.vue

Copy file name to clipboardExpand all lines: playground/vue/Main.vue
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<HmrCircularReference name="test" />
1212
<TypeProps msg="msg" bar="bar" :id="123" />
1313
<TypePropsTsx msg="msg" bar="bar" />
14+
<WithQuery />
1415
<Syntax />
1516
<PreProcessors />
1617
<PreProcessorsHmr />
@@ -44,6 +45,7 @@
4445
import { version, defineAsyncComponent } from 'vue'
4546
import Hmr from './Hmr.vue'
4647
import HmrTsx from './HmrTsx.vue'
48+
import WithQuery from './WithQuery.vue?with-query'
4749
import Syntax from './Syntax.vue'
4850
import PreProcessors from './PreProcessors.vue'
4951
import PreProcessorsHmr from './PreProcessorsHmr.vue'

‎playground/vue/WithQuery.vue

Copy file name to clipboard
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<template>
2+
<h2>Imported with query</h2>
3+
<p class="imported-with-query">{{ foo }}</p>
4+
</template>
5+
6+
<script setup>
7+
const foo = 'ok'
8+
</script>

‎playground/vue/__tests__/vue.spec.ts

Copy file name to clipboardExpand all lines: playground/vue/__tests__/vue.spec.ts
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ test('should update', async () => {
2222
expect(await page.textContent('.hmr-inc')).toMatch('count is 1')
2323
})
2424

25+
test('import with query should work', async () => {
26+
expect(await page.textContent('.imported-with-query')).toMatch('ok')
27+
})
28+
2529
test('template/script latest syntax support', async () => {
2630
expect(await page.textContent('.syntax')).toBe('baz')
2731
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.