Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ export default function loader(
sourceMap,
rootContext,
resourcePath,
resourceQuery = '',
resourceQuery: _resourceQuery = '',
} = loaderContext

const rawQuery = resourceQuery.slice(1)
const rawQuery = _resourceQuery.slice(1)
const incomingQuery = qs.parse(rawQuery)
const resourceQuery = rawQuery ? `&${rawQuery}` : ''
const options = (loaderUtils.getOptions(loaderContext) ||
{}) as VueLoaderOptions

Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/custom-query.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts">
import BasicComponent from './basic.vue?custom=true'

export default BasicComponent
</script>
8 changes: 8 additions & 0 deletions test/script.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@ test('named exports', async () => {
test('experimental <script setup>', async () => {
await mockBundleAndRun({ entry: 'ScriptSetup.vue' })
})

test('should handle custom resource query', async () => {
const { exports } = await mockBundleAndRun({
entry: 'custom-query.vue',
})

expect(exports.default.data().msg).toBe('Hello from Component A!')
})