@mpxjs/webpack-plugin 2.7.38 → 2.7.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/index.js CHANGED
@@ -870,7 +870,8 @@ class MpxWebpackPlugin {
870
870
  })
871
871
 
872
872
  JavascriptModulesPlugin.getCompilationHooks(compilation).renderStartup.tap('MpxWebpackPlugin', (source, module) => {
873
- if (module && mpx.exportModules.has(module)) {
873
+ const realModule = (module && module.rootModule) || module
874
+ if (realModule && mpx.exportModules.has(realModule)) {
874
875
  source = new ConcatSource(source)
875
876
  source.add('module.exports = __webpack_exports__;\n')
876
877
  }
@@ -1025,7 +1026,7 @@ class MpxWebpackPlugin {
1025
1026
  }))
1026
1027
  }
1027
1028
  }
1028
- if (/regenerator-runtime/.test(parser.state.module.resource)) {
1029
+ if (/regenerator/.test(parser.state.module.resource)) {
1029
1030
  if (callee.name === 'Function' && arg0 && arg0.value === 'r' && arg1 && arg1.value === 'regeneratorRuntime = r') {
1030
1031
  current.addPresentationalDependency(new ReplaceDependency('(function () {})', expr.range))
1031
1032
  }
@@ -1181,7 +1182,6 @@ class MpxWebpackPlugin {
1181
1182
  }
1182
1183
 
1183
1184
  const processedChunk = new Set()
1184
- const appName = mpx.appInfo.name
1185
1185
 
1186
1186
  function processChunk (chunk, isRuntime, relativeChunks) {
1187
1187
  const chunkFile = chunk.files.values().next().value
@@ -1205,7 +1205,7 @@ class MpxWebpackPlugin {
1205
1205
  // 引用runtime
1206
1206
  // 支付宝分包独立打包,通过全局context获取webpackJSONP
1207
1207
  if (mpx.mode === 'ali' && !mpx.isPluginMode) {
1208
- if (chunk.name === appName) {
1208
+ if (compilation.options.entry[chunk.name]) {
1209
1209
  // 在rootChunk中挂载jsonpCallback
1210
1210
  source.add('// process ali subpackages runtime in root chunk\n' +
1211
1211
  'var context = (function() { return this })() || Function("return this")();\n\n')
@@ -2094,7 +2094,7 @@ function processElement (el, root, options, meta) {
2094
2094
  processShow(el, options, root)
2095
2095
  }
2096
2096
 
2097
- if (transAli) {
2097
+ if (transAli || (srcMode === 'ali' && mode === 'ali')) {
2098
2098
  processAliStyleClassHack(el, options, root)
2099
2099
  processAliEventHack(el, options, root)
2100
2100
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.7.38",
3
+ "version": "2.7.42",
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": "29b5f9c3bad966c5ed2d3d16f49e6bcef55a0213"
83
+ "gitHead": "c93b582d76ccf1a0cd9ee073d12e436600e2f37d"
84
84
  }