@mpxjs/webpack-plugin 2.9.41-react.0 → 2.9.42
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/dependencies/DynamicEntryDependency.js +13 -4
- package/lib/index.js +33 -24
- package/lib/json-compiler/helper.js +6 -3
- package/lib/json-compiler/index.js +38 -13
- package/lib/react/processScript.js +3 -3
- package/lib/react/processTemplate.js +2 -3
- package/lib/runtime/components/web/mpx-scroll-view.vue +1 -1
- package/lib/runtime/stringify.wxs +7 -20
- package/lib/template-compiler/compiler.js +5 -12
- package/lib/template-compiler/gen-node-react.js +1 -1
- package/package.json +2 -2
|
@@ -35,7 +35,7 @@ class DynamicEntryDependency extends NullDependency {
|
|
|
35
35
|
|
|
36
36
|
addEntry (compilation, callback) {
|
|
37
37
|
const mpx = compilation.__mpx__
|
|
38
|
-
let { request, entryType, outputPath, relativePath, context, originEntryNode, publicPath, resolver } = this
|
|
38
|
+
let { request, entryType, outputPath, relativePath, context, originEntryNode, publicPath, resolver, extraOptions } = this
|
|
39
39
|
|
|
40
40
|
async.waterfall([
|
|
41
41
|
(callback) => {
|
|
@@ -89,6 +89,14 @@ class DynamicEntryDependency extends NullDependency {
|
|
|
89
89
|
originEntryNode.addChild(mpx.getEntryNode(entryModule, entryType))
|
|
90
90
|
})
|
|
91
91
|
}
|
|
92
|
+
if (mpx.dynamicEntryInfo[packageName] && extraOptions.isAsync) {
|
|
93
|
+
mpx.dynamicEntryInfo[packageName].entries.forEach(entry => {
|
|
94
|
+
if (entry.resource === resource && entry.filename === filename && entry.entryType === entryType) {
|
|
95
|
+
entry.hasAsync = true
|
|
96
|
+
}
|
|
97
|
+
return entry
|
|
98
|
+
})
|
|
99
|
+
}
|
|
92
100
|
// alreadyOutputted时直接返回,避免存在模块循环引用时死循环
|
|
93
101
|
return callback(null, { resultPath })
|
|
94
102
|
} else {
|
|
@@ -113,7 +121,8 @@ class DynamicEntryDependency extends NullDependency {
|
|
|
113
121
|
resource,
|
|
114
122
|
packageName,
|
|
115
123
|
filename,
|
|
116
|
-
entryType
|
|
124
|
+
entryType,
|
|
125
|
+
hasAsync: extraOptions.isAsync || false
|
|
117
126
|
})
|
|
118
127
|
}
|
|
119
128
|
}
|
|
@@ -145,9 +154,9 @@ class DynamicEntryDependency extends NullDependency {
|
|
|
145
154
|
mpx.subpackagesEntriesMap[packageRoot].push(this)
|
|
146
155
|
callback()
|
|
147
156
|
} else {
|
|
148
|
-
this.addEntry(compilation, (err,
|
|
157
|
+
this.addEntry(compilation, (err, result) => {
|
|
149
158
|
if (err) return callback(err)
|
|
150
|
-
this.resultPath = resultPath
|
|
159
|
+
this.resultPath = result.resultPath
|
|
151
160
|
callback()
|
|
152
161
|
})
|
|
153
162
|
}
|
package/lib/index.js
CHANGED
|
@@ -180,6 +180,7 @@ class MpxWebpackPlugin {
|
|
|
180
180
|
cssLangs: ['css', 'less', 'stylus', 'scss', 'sass']
|
|
181
181
|
}, options.nativeConfig)
|
|
182
182
|
options.webConfig = options.webConfig || {}
|
|
183
|
+
options.rnConfig = options.rnConfig || {}
|
|
183
184
|
options.partialCompileRules = options.partialCompileRules || null
|
|
184
185
|
options.asyncSubpackageRules = options.asyncSubpackageRules || []
|
|
185
186
|
options.optimizeRenderRules = options.optimizeRenderRules ? (Array.isArray(options.optimizeRenderRules) ? options.optimizeRenderRules : [options.optimizeRenderRules]) : []
|
|
@@ -669,6 +670,8 @@ class MpxWebpackPlugin {
|
|
|
669
670
|
nativeConfig: this.options.nativeConfig,
|
|
670
671
|
// 输出web专用配置
|
|
671
672
|
webConfig: this.options.webConfig,
|
|
673
|
+
// 输出rn专用配置
|
|
674
|
+
rnConfig: this.options.rnConfig,
|
|
672
675
|
loaderContentCache: new Map(),
|
|
673
676
|
tabBarMap: {},
|
|
674
677
|
defs: processDefs(this.options.defs),
|
|
@@ -683,7 +686,7 @@ class MpxWebpackPlugin {
|
|
|
683
686
|
forceProxyEventRules: this.options.forceProxyEventRules,
|
|
684
687
|
supportRequireAsync: this.options.mode === 'wx' || this.options.mode === 'ali' || isWeb(this.options.mode),
|
|
685
688
|
partialCompileRules: this.options.partialCompileRules,
|
|
686
|
-
collectDynamicEntryInfo: ({ resource, packageName, filename, entryType }) => {
|
|
689
|
+
collectDynamicEntryInfo: ({ resource, packageName, filename, entryType, hasAsync }) => {
|
|
687
690
|
const curInfo = mpx.dynamicEntryInfo[packageName] = mpx.dynamicEntryInfo[packageName] || {
|
|
688
691
|
hasPage: false,
|
|
689
692
|
entries: []
|
|
@@ -692,7 +695,8 @@ class MpxWebpackPlugin {
|
|
|
692
695
|
curInfo.entries.push({
|
|
693
696
|
entryType,
|
|
694
697
|
resource,
|
|
695
|
-
filename
|
|
698
|
+
filename,
|
|
699
|
+
hasAsync
|
|
696
700
|
})
|
|
697
701
|
},
|
|
698
702
|
asyncSubpackageRules: this.options.asyncSubpackageRules,
|
|
@@ -1244,31 +1248,35 @@ class MpxWebpackPlugin {
|
|
|
1244
1248
|
compilation.hooks.processAssets.tap({
|
|
1245
1249
|
name: 'MpxWebpackPlugin'
|
|
1246
1250
|
}, (assets) => {
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
for (const
|
|
1250
|
-
const
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1251
|
+
try {
|
|
1252
|
+
const dynamicAssets = {}
|
|
1253
|
+
for (const packageName in mpx.runtimeInfo) {
|
|
1254
|
+
for (const resourcePath in mpx.runtimeInfo[packageName]) {
|
|
1255
|
+
const { moduleId, template, style, json } = mpx.runtimeInfo[packageName][resourcePath]
|
|
1256
|
+
const templateAst = mpx.changeHashNameForAstNode(template.templateAst, json)
|
|
1257
|
+
dynamicAssets[moduleId] = {
|
|
1258
|
+
template: JSON.parse(templateAst),
|
|
1259
|
+
styles: style.reduce((preV, curV) => {
|
|
1260
|
+
preV.push(...curV)
|
|
1261
|
+
return preV
|
|
1262
|
+
}, [])
|
|
1263
|
+
}
|
|
1259
1264
|
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1265
|
+
// 注入 dynamic slot dependency
|
|
1266
|
+
const outputPath = mpx.componentsMap[packageName][resourcePath]
|
|
1267
|
+
if (outputPath) {
|
|
1268
|
+
const jsonAsset = outputPath + '.json'
|
|
1269
|
+
const jsonContent = compilation.assets[jsonAsset].source()
|
|
1270
|
+
compilation.assets[jsonAsset] = new RawSource(mpx.injectDynamicSlotDependencies(jsonContent, resourcePath))
|
|
1271
|
+
}
|
|
1266
1272
|
}
|
|
1267
1273
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1274
|
+
if (!isEmptyObject(dynamicAssets)) {
|
|
1275
|
+
// 产出 jsonAst 静态产物
|
|
1276
|
+
compilation.assets['dynamic.json'] = new RawSource(JSON.stringify(dynamicAssets))
|
|
1277
|
+
}
|
|
1278
|
+
} catch (error) {
|
|
1279
|
+
compilation.errors.push(error)
|
|
1272
1280
|
}
|
|
1273
1281
|
})
|
|
1274
1282
|
|
|
@@ -1328,6 +1336,7 @@ class MpxWebpackPlugin {
|
|
|
1328
1336
|
parser.state.current.addBlock(depBlock)
|
|
1329
1337
|
} else {
|
|
1330
1338
|
const dep = new DynamicEntryDependency(range, request, 'export', '', tarRoot, '', context, {
|
|
1339
|
+
isAsync: true,
|
|
1331
1340
|
isRequireAsync: true,
|
|
1332
1341
|
retryRequireAsync: !!this.options.retryRequireAsync
|
|
1333
1342
|
})
|
|
@@ -7,6 +7,7 @@ const addQuery = require('../utils/add-query')
|
|
|
7
7
|
const loaderUtils = require('loader-utils')
|
|
8
8
|
const resolve = require('../utils/resolve')
|
|
9
9
|
const { matchCondition } = require('../utils/match-condition')
|
|
10
|
+
const { isWeb, isReact } = require('../utils/env')
|
|
10
11
|
|
|
11
12
|
module.exports = function createJSONHelper ({ loaderContext, emitWarning, customGetDynamicEntry }) {
|
|
12
13
|
const mpx = loaderContext.getMpx()
|
|
@@ -58,11 +59,13 @@ module.exports = function createJSONHelper ({ loaderContext, emitWarning, custom
|
|
|
58
59
|
// 目前只有微信支持分包异步化
|
|
59
60
|
if (supportRequireAsync) {
|
|
60
61
|
tarRoot = queryObj.root
|
|
62
|
+
extraOptions.isAsync = true
|
|
61
63
|
}
|
|
62
64
|
} else if (!queryObj.root && asyncSubpackageRules && supportRequireAsync) {
|
|
63
65
|
for (const item of asyncSubpackageRules) {
|
|
64
66
|
if (matchCondition(resourcePath, item)) {
|
|
65
67
|
tarRoot = item.root
|
|
68
|
+
extraOptions.isAsync = true
|
|
66
69
|
placeholder = item.placeholder
|
|
67
70
|
break
|
|
68
71
|
}
|
|
@@ -74,7 +77,7 @@ module.exports = function createJSONHelper ({ loaderContext, emitWarning, custom
|
|
|
74
77
|
const resourceName = path.join(parsed.dir, parsed.name)
|
|
75
78
|
|
|
76
79
|
if (!outputPath) {
|
|
77
|
-
if (isScript(ext) && resourceName.includes('node_modules') && mode
|
|
80
|
+
if (isScript(ext) && resourceName.includes('node_modules') && !isWeb(mode) && !isReact(mode)) {
|
|
78
81
|
let root = info.descriptionFileRoot
|
|
79
82
|
let name = 'nativeComponent'
|
|
80
83
|
if (info.descriptionFileData) {
|
|
@@ -92,7 +95,7 @@ module.exports = function createJSONHelper ({ loaderContext, emitWarning, custom
|
|
|
92
95
|
outputPath = getOutputPath(resourcePath, 'component')
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
|
-
if (isScript(ext) && mode
|
|
98
|
+
if (isScript(ext) && !isWeb(mode) && !isReact(mode)) {
|
|
96
99
|
resource = `!!${nativeLoaderPath}!${resource}`
|
|
97
100
|
}
|
|
98
101
|
|
|
@@ -137,7 +140,7 @@ module.exports = function createJSONHelper ({ loaderContext, emitWarning, custom
|
|
|
137
140
|
outputPath = /^(.*?)(\.[^.]*)?$/.exec(relative)[1]
|
|
138
141
|
}
|
|
139
142
|
}
|
|
140
|
-
if (isScript(ext) && mode
|
|
143
|
+
if (isScript(ext) && !isWeb(mode) && !isReact(mode)) {
|
|
141
144
|
resource = `!!${nativeLoaderPath}!${resource}`
|
|
142
145
|
}
|
|
143
146
|
const entry = getDynamicEntry(resource, 'page', outputPath, tarRoot, publicPath + tarRoot)
|
|
@@ -73,11 +73,11 @@ module.exports = function (content) {
|
|
|
73
73
|
const normalizePlaceholder = (placeholder) => {
|
|
74
74
|
if (typeof placeholder === 'string') {
|
|
75
75
|
const placeholderMap = mode === 'ali'
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
? {
|
|
77
|
+
view: { name: 'mpx-view', resource: mpxViewPath },
|
|
78
|
+
text: { name: 'mpx-text', resource: mpxTextPath }
|
|
79
|
+
}
|
|
80
|
+
: {}
|
|
81
81
|
placeholder = placeholderMap[placeholder] || { name: placeholder }
|
|
82
82
|
}
|
|
83
83
|
if (!placeholder.name) {
|
|
@@ -275,7 +275,8 @@ module.exports = function (content) {
|
|
|
275
275
|
callback()
|
|
276
276
|
}
|
|
277
277
|
})
|
|
278
|
-
}, () => {
|
|
278
|
+
}, (err) => {
|
|
279
|
+
if (err) return callback(err)
|
|
279
280
|
const mpxCustomElementPath = resolveMpxCustomElementPath(packageName)
|
|
280
281
|
if (runtimeCompile) {
|
|
281
282
|
components.element = mpxCustomElementPath
|
|
@@ -325,7 +326,8 @@ module.exports = function (content) {
|
|
|
325
326
|
}
|
|
326
327
|
callback()
|
|
327
328
|
})
|
|
328
|
-
}, () => {
|
|
329
|
+
}, (err) => {
|
|
330
|
+
if (err) return callback(err)
|
|
329
331
|
if (tarRoot && subPackagesCfg) {
|
|
330
332
|
if (!subPackagesCfg[tarRoot].pages.length && pagesCache[0]) {
|
|
331
333
|
subPackagesCfg[tarRoot].pages.push(pagesCache[0])
|
|
@@ -576,12 +578,12 @@ module.exports = function (content) {
|
|
|
576
578
|
const srcCustomKey = config[srcMode].tabBar.customKey
|
|
577
579
|
const srcPath = resolveTabBarPath(srcCustomKey)
|
|
578
580
|
const outputPath = resolveTabBarPath(outputCustomKey)
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
581
|
+
processComponent(`./${srcPath}`, context, {
|
|
582
|
+
outputPath,
|
|
583
|
+
extraOptions: {
|
|
584
|
+
replaceContent: 'true'
|
|
585
|
+
}
|
|
586
|
+
}, (err, entry) => {
|
|
585
587
|
if (err === RESOLVE_IGNORED_ERR) {
|
|
586
588
|
delete tabBar[srcCustomKey]
|
|
587
589
|
return callback()
|
|
@@ -595,6 +597,26 @@ module.exports = function (content) {
|
|
|
595
597
|
}
|
|
596
598
|
}
|
|
597
599
|
|
|
600
|
+
const processAppBar = (appBar, context, callback) => {
|
|
601
|
+
if (appBar) {
|
|
602
|
+
processComponent('./app-bar/index', context, {
|
|
603
|
+
outputPath: 'app-bar/index',
|
|
604
|
+
extraOptions: {
|
|
605
|
+
replaceContent: 'true'
|
|
606
|
+
}
|
|
607
|
+
}, (err, entry) => {
|
|
608
|
+
if (err === RESOLVE_IGNORED_ERR) {
|
|
609
|
+
return callback()
|
|
610
|
+
}
|
|
611
|
+
if (err) return callback(err)
|
|
612
|
+
appBar.custom = entry // hack for javascript parser call hook.
|
|
613
|
+
callback()
|
|
614
|
+
})
|
|
615
|
+
} else {
|
|
616
|
+
callback()
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
|
|
598
620
|
const processPluginGenericsImplementation = (plugin, context, tarRoot, callback) => {
|
|
599
621
|
if (!plugin.genericsImplementation) return callback()
|
|
600
622
|
const relativePath = useRelativePath ? publicPath + tarRoot : ''
|
|
@@ -671,6 +693,9 @@ module.exports = function (content) {
|
|
|
671
693
|
},
|
|
672
694
|
(callback) => {
|
|
673
695
|
processSubPackages(json.subPackages || json.subpackages, this.context, callback)
|
|
696
|
+
},
|
|
697
|
+
(callback) => {
|
|
698
|
+
processAppBar(json.appBar, this.context, callback)
|
|
674
699
|
}
|
|
675
700
|
], (err) => {
|
|
676
701
|
if (err) return callback(err)
|
|
@@ -26,13 +26,13 @@ module.exports = function (script, {
|
|
|
26
26
|
import { getComponent } from ${stringifyRequest(loaderContext, optionProcessorPath)}
|
|
27
27
|
import { NavigationContainer, createNavigationContainerRef, StackActions } from '@react-navigation/native'
|
|
28
28
|
import { createNativeStackNavigator } from '@react-navigation/native-stack'
|
|
29
|
-
import {
|
|
29
|
+
import { Provider } from '@ant-design/react-native'
|
|
30
30
|
global.__navigationHelper = {
|
|
31
31
|
NavigationContainer: NavigationContainer,
|
|
32
32
|
createNavigationContainerRef: createNavigationContainerRef,
|
|
33
33
|
createNativeStackNavigator: createNativeStackNavigator,
|
|
34
34
|
StackActions: StackActions,
|
|
35
|
-
|
|
35
|
+
Provider: Provider
|
|
36
36
|
}\n`
|
|
37
37
|
const { pagesMap, firstPage } = buildPagesMap({
|
|
38
38
|
localPagesMap,
|
|
@@ -59,7 +59,7 @@ global.__navigationHelper = {
|
|
|
59
59
|
jsonConfig
|
|
60
60
|
})
|
|
61
61
|
|
|
62
|
-
output += buildGlobalParams({ moduleId, scriptSrcMode, loaderContext, isProduction, componentsMap })
|
|
62
|
+
output += buildGlobalParams({ moduleId, scriptSrcMode, loaderContext, isProduction, ctorType, jsonConfig, componentsMap })
|
|
63
63
|
output += getRequireScript({ ctorType, script, loaderContext })
|
|
64
64
|
output += `export default global.__mpxOptionsMap[${JSON.stringify(moduleId)}]\n`
|
|
65
65
|
}
|
|
@@ -112,14 +112,13 @@ module.exports = function (template, {
|
|
|
112
112
|
try {
|
|
113
113
|
const ignoreMap = Object.assign({
|
|
114
114
|
createElement: true,
|
|
115
|
-
|
|
116
|
-
getNativeComponent: true,
|
|
115
|
+
getComponent: true,
|
|
117
116
|
rootProps: true
|
|
118
117
|
}, meta.wxsModuleMap)
|
|
119
118
|
const bindResult = bindThis.transform(rawCode, {
|
|
120
119
|
ignoreMap
|
|
121
120
|
})
|
|
122
|
-
output += `global.currentInject.render = function (createElement,
|
|
121
|
+
output += `global.currentInject.render = function (createElement, getComponent, rootProps) {
|
|
123
122
|
return ${bindResult.code}
|
|
124
123
|
};\n`
|
|
125
124
|
} catch (e) {
|
|
@@ -8,38 +8,25 @@ function objectKeys (obj) {
|
|
|
8
8
|
'[': ']',
|
|
9
9
|
'(': ')'
|
|
10
10
|
}
|
|
11
|
-
var shiftMap = {
|
|
12
|
-
'n': '\n',
|
|
13
|
-
'b': '\b',
|
|
14
|
-
'f': '\f',
|
|
15
|
-
'r': '\r',
|
|
16
|
-
't': '\t'
|
|
17
|
-
}
|
|
18
11
|
if (typeof obj === 'object') {
|
|
19
12
|
var objStr = JSON.stringify(obj)
|
|
20
13
|
if (objStr[0] === '{' && objStr[objStr.length - 1] === '}') {
|
|
21
|
-
var key = ''
|
|
22
14
|
var inKey = true
|
|
23
15
|
var stack = []
|
|
24
|
-
var
|
|
16
|
+
var keyStart = 0
|
|
17
|
+
var keyEnd = 0
|
|
25
18
|
for (var i = 1; i < objStr.length - 1; i++) {
|
|
26
19
|
var item = objStr[i]
|
|
27
20
|
var lastItem = objStr[i - 1]
|
|
28
21
|
if (inKey) {
|
|
29
|
-
if (item === ':' &&
|
|
30
|
-
keys.push(
|
|
31
|
-
key = ''
|
|
22
|
+
if (item === ':' && keyEnd === i - 1) {
|
|
23
|
+
keys.push(objStr.slice(keyStart + 1, keyEnd))
|
|
32
24
|
inKey = false
|
|
33
25
|
} else {
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
if (shift) {
|
|
39
|
-
item = shiftMap[item] || item
|
|
40
|
-
shift = false
|
|
26
|
+
if (item === '"' && lastItem !== '\\') {
|
|
27
|
+
keyStart = keyEnd
|
|
28
|
+
keyEnd = i
|
|
41
29
|
}
|
|
42
|
-
key += item
|
|
43
30
|
}
|
|
44
31
|
} else {
|
|
45
32
|
if (stackMap[item]) {
|
|
@@ -1654,9 +1654,10 @@ function processFor (el) {
|
|
|
1654
1654
|
}
|
|
1655
1655
|
}
|
|
1656
1656
|
|
|
1657
|
-
function processRefReact (el,
|
|
1657
|
+
function processRefReact (el, meta) {
|
|
1658
1658
|
const val = getAndRemoveAttr(el, config[mode].directive.ref).val
|
|
1659
|
-
|
|
1659
|
+
// rn中只有内建组件能被作为node ref处理
|
|
1660
|
+
const type = el.isBuiltIn ? 'node' : 'component'
|
|
1660
1661
|
if (val) {
|
|
1661
1662
|
if (!meta.refs) {
|
|
1662
1663
|
meta.refs = []
|
|
@@ -2484,12 +2485,6 @@ function processMpxTagName (el) {
|
|
|
2484
2485
|
}
|
|
2485
2486
|
}
|
|
2486
2487
|
|
|
2487
|
-
function postProcessComponent (el, options) {
|
|
2488
|
-
if (isComponentNode(el, options)) {
|
|
2489
|
-
el.isComponent = true
|
|
2490
|
-
}
|
|
2491
|
-
}
|
|
2492
|
-
|
|
2493
2488
|
function processElement (el, root, options, meta) {
|
|
2494
2489
|
processAtMode(el)
|
|
2495
2490
|
// 如果已经标记了这个元素要被清除,直接return跳过后续处理步骤
|
|
@@ -2528,7 +2523,7 @@ function processElement (el, root, options, meta) {
|
|
|
2528
2523
|
// 预处理代码维度条件编译
|
|
2529
2524
|
processIf(el)
|
|
2530
2525
|
processFor(el)
|
|
2531
|
-
processRefReact(el,
|
|
2526
|
+
processRefReact(el, meta)
|
|
2532
2527
|
processStyleReact(el)
|
|
2533
2528
|
processEventReact(el, options, meta)
|
|
2534
2529
|
processComponentIs(el, options)
|
|
@@ -2581,8 +2576,6 @@ function closeElement (el, meta, options) {
|
|
|
2581
2576
|
if (isReact(mode)) {
|
|
2582
2577
|
postProcessForReact(el)
|
|
2583
2578
|
postProcessIfReact(el)
|
|
2584
|
-
// flag component for react
|
|
2585
|
-
postProcessComponent(el, options)
|
|
2586
2579
|
return
|
|
2587
2580
|
}
|
|
2588
2581
|
const pass = isNative || postProcessTemplate(el) || processingTemplate
|
|
@@ -2961,7 +2954,7 @@ function postProcessForDynamic (vnode) {
|
|
|
2961
2954
|
}
|
|
2962
2955
|
|
|
2963
2956
|
function postProcessAttrsDynamic (vnode, config) {
|
|
2964
|
-
const exps = vnode.exps
|
|
2957
|
+
const exps = (vnode.exps && vnode.exps.filter(v => v.attrName)) || []
|
|
2965
2958
|
const expsMap = Object.fromEntries(exps.map(v => ([v.attrName, v])))
|
|
2966
2959
|
const directives = Object.values(config.directive)
|
|
2967
2960
|
if (vnode.attrsList && vnode.attrsList.length) {
|
|
@@ -59,7 +59,7 @@ function genNode (node) {
|
|
|
59
59
|
const name = node.slot.name
|
|
60
60
|
exp += `__getSlot(${name ? s(name) : ''})`
|
|
61
61
|
} else {
|
|
62
|
-
exp += `createElement(${
|
|
62
|
+
exp += `createElement(${`getComponent(${node.is || s(node.tag)})`}`
|
|
63
63
|
if (node.isRoot) {
|
|
64
64
|
exp += `, Object.assign({}, rootProps, {style: [${attrExpMap.style}, rootProps.style]})`
|
|
65
65
|
} else if (node.attrsList.length) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.42",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"engines": {
|
|
86
86
|
"node": ">=14.14.0"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "45c7fd96af6723fa8c8ea2d659065417e66c77e2"
|
|
89
89
|
}
|