Skip to content

Commit b271eb9

Browse files
committedNov 3, 2022
Merge branch 'next' into feat/css-modules-named-export
2 parents 62f6249 + 1b1a195 commit b271eb9

7 files changed

+38
-5
lines changed
 

‎CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## [17.0.1](https://github.com/vuejs/vue-loader/compare/v16.8.3...v17.0.1) (2022-10-28)
2+
3+
4+
### Bug Fixes
5+
6+
* add `vue` and `@vue/compiler-sfc` to optional peerDependencies ([df0ded5](https://github.com/vuejs/vue-loader/commit/df0ded5356864b9923da8f89ff33db1ae6c2402f)), closes [#1944](https://github.com/vuejs/vue-loader/issues/1944)
7+
* merge custom queries rather than appending ([#1911](https://github.com/vuejs/vue-loader/issues/1911)) ([9e4249a](https://github.com/vuejs/vue-loader/commit/9e4249a548ceb04ead46fff9b68e9b2676b4c692))
8+
9+
10+
111
# [17.0.0](https://github.com/vuejs/vue-loader/compare/v16.8.3...v17.0.0) (2021-12-12)
212

313

‎package.json

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"name": "vue-loader",
3-
"version": "17.0.0",
3+
"version": "17.0.1",
44
"license": "MIT",
55
"author": "Evan You",
6+
"repository": "vuejs/vue-loader",
67
"main": "dist/index.js",
78
"types": "dist/index.d.ts",
89
"files": [
@@ -39,6 +40,14 @@
3940
"peerDependencies": {
4041
"webpack": "^4.1.0 || ^5.0.0-0"
4142
},
43+
"peerDependenciesMeta": {
44+
"@vue/compiler-sfc": {
45+
"optional": true
46+
},
47+
"vue": {
48+
"optional": true
49+
}
50+
},
4251
"devDependencies": {
4352
"@babel/core": "^7.7.7",
4453
"@babel/preset-env": "^7.11.5",

‎src/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@ export default function loader(
7575
sourceMap,
7676
rootContext,
7777
resourcePath,
78-
resourceQuery = '',
78+
resourceQuery: _resourceQuery = '',
7979
} = loaderContext
8080

81-
const rawQuery = resourceQuery.slice(1)
81+
const rawQuery = _resourceQuery.slice(1)
8282
const incomingQuery = qs.parse(rawQuery)
83+
const resourceQuery = rawQuery ? `&${rawQuery}` : ''
8384
const options = (loaderUtils.getOptions(loaderContext) ||
8485
{}) as VueLoaderOptions
8586

‎src/pluginWebpack4.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class VueLoaderPlugin implements webpack.Plugin {
6161
const vueLoaderOptions = (vueLoaderUse.options =
6262
vueLoaderUse.options || {}) as VueLoaderOptions
6363

64-
// for each user rule (expect the vue rule), create a cloned rule
64+
// for each user rule (except the vue rule), create a cloned rule
6565
// that targets the corresponding language blocks in *.vue files.
6666
const clonedRules = rules.filter((r) => r !== vueRule).map(cloneRule)
6767

‎src/pluginWebpack5.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class VueLoaderPlugin implements Plugin {
165165
const vueLoaderOptions = (vueLoaderUse.options =
166166
vueLoaderUse.options || {}) as VueLoaderOptions
167167

168-
// for each user rule (expect the vue rule), create a cloned rule
168+
// for each user rule (except the vue rule), create a cloned rule
169169
// that targets the corresponding language blocks in *.vue files.
170170
const refs = new Map()
171171
const clonedRules = rules

‎test/fixtures/custom-query.vue

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script lang="ts">
2+
import BasicComponent from './basic.vue?custom=true'
3+
4+
export default BasicComponent
5+
</script>

‎test/script.spec.ts

+8
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@ test('named exports', async () => {
1111
test('experimental <script setup>', async () => {
1212
await mockBundleAndRun({ entry: 'ScriptSetup.vue' })
1313
})
14+
15+
test('should handle custom resource query', async () => {
16+
const { exports } = await mockBundleAndRun({
17+
entry: 'custom-query.vue',
18+
})
19+
20+
expect(exports.default.data().msg).toBe('Hello from Component A!')
21+
})

0 commit comments

Comments
 (0)
Failed to load comments.