Skip to content

Commit 379e41c

Browse files
committed
fix: 修复组件.mode后缀路径infix参数重复拼接
1 parent adf8696 commit 379e41c

File tree

6 files changed

+69
-2
lines changed

6 files changed

+69
-2
lines changed

packages/webpack-plugin/lib/resolver/AddModePlugin.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ module.exports = class AddModePlugin {
2424
if (request.mode || request.env) {
2525
return callback()
2626
}
27+
28+
const queryObj = parseQuery(request.query || '?')
29+
if (queryObj.mode) {
30+
return callback()
31+
}
32+
2733
const obj = {
2834
mode
2935
}
@@ -37,7 +43,6 @@ module.exports = class AddModePlugin {
3743
// 当前资源没有后缀名或者路径不符合fileConditionRules规则时,直接返回
3844
if (!extname || !matchCondition(resourcePath, fileConditionRules)) return callback()
3945

40-
const queryObj = parseQuery(request.query || '?')
4146
const queryInfix = queryObj.infix
4247
if (!implicitMode) queryObj.mode = mode
4348
queryObj.infix = `${queryInfix || ''}.${mode}`
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<view> ali </view>
3+
</template>
4+
5+
<script>
6+
import { createComponent } from '@mpxjs/core'
7+
8+
createComponent({})
9+
</script>
10+
11+
<script type="application/json">
12+
{
13+
"component": true
14+
}
15+
</script>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<view> ali </view>
3+
</template>
4+
5+
<script>
6+
import { createComponent } from '@mpxjs/core'
7+
8+
createComponent({})
9+
</script>
10+
11+
<script type="application/json">
12+
{
13+
"component": true
14+
}
15+
</script>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<view> ali </view>
3+
</template>
4+
5+
<script>
6+
import { createComponent } from '@mpxjs/core'
7+
8+
createComponent({})
9+
</script>
10+
11+
<script type="application/json">
12+
{
13+
"component": true
14+
}
15+
</script>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<view> wx </view>
3+
</template>
4+
5+
<script>
6+
import { createComponent } from '@mpxjs/core'
7+
8+
createComponent({})
9+
</script>
10+
11+
<script type="application/json">
12+
{
13+
"component": true
14+
}
15+
</script>

test/e2e/miniprogram-project/src/pages/index.mpx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<view>
33
<list></list>
44
<customOutputComp></customOutputComp>
5+
<mode></mode>
56
</view>
67
</template>
78

@@ -17,7 +18,8 @@
1718
{
1819
"usingComponents": {
1920
"list": "../components/list",
20-
"customOutputComp": "../components/customOutputCom.mpx"
21+
"customOutputComp": "../components/customOutputCom.mpx",
22+
"mode": "../components/mode",
2123
}
2224
}
2325
</script>

0 commit comments

Comments
 (0)