@mpxjs/webpack-plugin 2.7.16 → 2.7.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +2 -1
- package/lib/loader.js +12 -2
- package/lib/runtime/components/web/mpx-image.vue +13 -5
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const ReplaceDependency = require('./dependencies/ReplaceDependency')
|
|
|
8
8
|
const NullFactory = require('webpack/lib/NullFactory')
|
|
9
9
|
const CommonJsVariableDependency = require('./dependencies/CommonJsVariableDependency')
|
|
10
10
|
const CommonJsAsyncDependency = require('./dependencies/CommonJsAsyncDependency')
|
|
11
|
+
const harmonySpecifierTag = require('webpack/lib/dependencies/HarmonyImportDependencyParserPlugin').harmonySpecifierTag
|
|
11
12
|
const NormalModule = require('webpack/lib/NormalModule')
|
|
12
13
|
const EntryPlugin = require('webpack/lib/EntryPlugin')
|
|
13
14
|
const JavascriptModulesPlugin = require('webpack/lib/javascript/JavascriptModulesPlugin')
|
|
@@ -1123,7 +1124,7 @@ class MpxWebpackPlugin {
|
|
|
1123
1124
|
}
|
|
1124
1125
|
|
|
1125
1126
|
if (mpx.srcMode !== mpx.mode) {
|
|
1126
|
-
parser.hooks.callMemberChain.for(
|
|
1127
|
+
parser.hooks.callMemberChain.for(harmonySpecifierTag).tap('MpxWebpackPlugin', handler)
|
|
1127
1128
|
parser.hooks.callMemberChain.for('mpx').tap('MpxWebpackPlugin', handler)
|
|
1128
1129
|
parser.hooks.callMemberChain.for('wx').tap('MpxWebpackPlugin', handler)
|
|
1129
1130
|
}
|
package/lib/loader.js
CHANGED
|
@@ -18,15 +18,23 @@ const AppEntryDependency = require('./dependencies/AppEntryDependency')
|
|
|
18
18
|
const RecordResourceMapDependency = require('./dependencies/RecordResourceMapDependency')
|
|
19
19
|
const CommonJsVariableDependency = require('./dependencies/CommonJsVariableDependency')
|
|
20
20
|
const { MPX_APP_MODULE_ID } = require('./utils/const')
|
|
21
|
+
const path = require('path')
|
|
21
22
|
|
|
22
23
|
module.exports = function (content) {
|
|
23
24
|
this.cacheable()
|
|
24
25
|
|
|
26
|
+
// 兼容处理处理ts-loader中watch-run/updateFile逻辑,直接跳过当前loader及后续的vue-loader返回内容
|
|
27
|
+
if (path.extname(this.resourcePath) === '.ts') {
|
|
28
|
+
this.loaderIndex -= 2
|
|
29
|
+
return content
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
const mpx = this.getMpx()
|
|
26
33
|
if (!mpx) {
|
|
27
34
|
return content
|
|
28
35
|
}
|
|
29
36
|
const { resourcePath, queryObj } = parseRequest(this.resource)
|
|
37
|
+
|
|
30
38
|
const packageRoot = queryObj.packageRoot || mpx.currentPackageRoot
|
|
31
39
|
const packageName = packageRoot || 'main'
|
|
32
40
|
const independent = queryObj.independent
|
|
@@ -298,8 +306,10 @@ module.exports = function (content) {
|
|
|
298
306
|
// require style
|
|
299
307
|
output += getRequire('styles', style, extraOptions, i) + '\n'
|
|
300
308
|
})
|
|
301
|
-
}
|
|
302
|
-
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (parts.styles.filter(style => !style.src).length === 0 && ctorType === 'app' && mode === 'ali') {
|
|
312
|
+
output += getRequire('styles', {}, {}, parts.styles.length) + '\n'
|
|
303
313
|
}
|
|
304
314
|
|
|
305
315
|
// json
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
height: this.image.height
|
|
30
30
|
}
|
|
31
31
|
})
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
this.$emit('load', e)
|
|
34
34
|
}
|
|
35
35
|
this.image.onerror = (e) => {
|
|
@@ -45,14 +45,22 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
render (createElement) {
|
|
48
|
-
if (this.mode === 'widthFix') {
|
|
48
|
+
if (this.mode === 'widthFix' || this.mode === 'heightFix') {
|
|
49
|
+
let style
|
|
50
|
+
if (this.mode === 'widthFix') {
|
|
51
|
+
style = {
|
|
52
|
+
height: 'auto'
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
style = {
|
|
56
|
+
width: 'auto'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
49
59
|
const domProps = {}
|
|
50
60
|
if (this.src) domProps.src = this.src
|
|
51
61
|
return createElement('img', {
|
|
52
62
|
domProps,
|
|
53
|
-
style
|
|
54
|
-
height: 'auto'
|
|
55
|
-
},
|
|
63
|
+
style,
|
|
56
64
|
class: ['mpx-image'],
|
|
57
65
|
on: getInnerListeners(this, { ignoredListeners: ['load', 'error'] })
|
|
58
66
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.17",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"engines": {
|
|
81
81
|
"node": ">=14.14.0"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "6079aab5d336ecfac4a94a2fef44aa989cdf6614"
|
|
84
84
|
}
|