Skip to content

Commit

Permalink
Merge branch 'next' into feat/css-modules-named-export
Browse files Browse the repository at this point in the history
  • Loading branch information
Airkro committed Nov 3, 2022
2 parents 62f6249 + 1b1a195 commit b271eb9
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 5 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,13 @@
## [17.0.1](https://github.com/vuejs/vue-loader/compare/v16.8.3...v17.0.1) (2022-10-28)


### Bug Fixes

* 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)
* merge custom queries rather than appending ([#1911](https://github.com/vuejs/vue-loader/issues/1911)) ([9e4249a](https://github.com/vuejs/vue-loader/commit/9e4249a548ceb04ead46fff9b68e9b2676b4c692))



# [17.0.0](https://github.com/vuejs/vue-loader/compare/v16.8.3...v17.0.0) (2021-12-12)


Expand Down
11 changes: 10 additions & 1 deletion package.json
@@ -1,8 +1,9 @@
{
"name": "vue-loader",
"version": "17.0.0",
"version": "17.0.1",
"license": "MIT",
"author": "Evan You",
"repository": "vuejs/vue-loader",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand Down Expand Up @@ -39,6 +40,14 @@
"peerDependencies": {
"webpack": "^4.1.0 || ^5.0.0-0"
},
"peerDependenciesMeta": {
"@vue/compiler-sfc": {
"optional": true
},
"vue": {
"optional": true
}
},
"devDependencies": {
"@babel/core": "^7.7.7",
"@babel/preset-env": "^7.11.5",
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
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
2 changes: 1 addition & 1 deletion src/pluginWebpack4.ts
Expand Up @@ -61,7 +61,7 @@ class VueLoaderPlugin implements webpack.Plugin {
const vueLoaderOptions = (vueLoaderUse.options =
vueLoaderUse.options || {}) as VueLoaderOptions

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

Expand Down
2 changes: 1 addition & 1 deletion src/pluginWebpack5.ts
Expand Up @@ -165,7 +165,7 @@ class VueLoaderPlugin implements Plugin {
const vueLoaderOptions = (vueLoaderUse.options =
vueLoaderUse.options || {}) as VueLoaderOptions

// for each user rule (expect the vue rule), create a cloned rule
// for each user rule (except the vue rule), create a cloned rule
// that targets the corresponding language blocks in *.vue files.
const refs = new Map()
const clonedRules = rules
Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/custom-query.vue
@@ -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
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!')
})

0 comments on commit b271eb9

Please sign in to comment.