@mpxjs/webpack-plugin 2.9.21 → 2.9.26

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
@@ -172,7 +172,6 @@ class MpxWebpackPlugin {
172
172
  options.asyncSubpackageRules = options.asyncSubpackageRules || []
173
173
  options.optimizeRenderRules = options.optimizeRenderRules ? (Array.isArray(options.optimizeRenderRules) ? options.optimizeRenderRules : [options.optimizeRenderRules]) : []
174
174
  options.retryRequireAsync = options.retryRequireAsync || false
175
- options.enableAliRequireAsync = options.enableAliRequireAsync || false
176
175
  options.optimizeSize = options.optimizeSize || false
177
176
  this.options = options
178
177
  // Hack for buildDependencies
@@ -649,7 +648,7 @@ class MpxWebpackPlugin {
649
648
  useRelativePath: this.options.useRelativePath,
650
649
  removedChunks: [],
651
650
  forceProxyEventRules: this.options.forceProxyEventRules,
652
- supportRequireAsync: this.options.mode === 'wx' || this.options.mode === 'web' || (this.options.mode === 'ali' && this.options.enableAliRequireAsync),
651
+ supportRequireAsync: this.options.mode === 'wx' || this.options.mode === 'web' || this.options.mode === 'ali',
653
652
  partialCompile: this.options.partialCompile,
654
653
  collectDynamicEntryInfo: ({ resource, packageName, filename, entryType }) => {
655
654
  const curInfo = mpx.dynamicEntryInfo[packageName] = mpx.dynamicEntryInfo[packageName] || {
@@ -1126,7 +1125,7 @@ class MpxWebpackPlugin {
1126
1125
  if (tarRoot) {
1127
1126
  // 删除root query
1128
1127
  if (queryObj.root) request = addQuery(request, {}, false, ['root'])
1129
- // wx、ali(需开启enableAliRequireAsync)和web平台支持require.async,其余平台使用CommonJsAsyncDependency进行模拟抹平
1128
+ // wx、ali和web平台支持require.async,其余平台使用CommonJsAsyncDependency进行模拟抹平
1130
1129
  if (mpx.supportRequireAsync) {
1131
1130
  if (mpx.mode === 'web') {
1132
1131
  const depBlock = new AsyncDependenciesBlock(
@@ -442,11 +442,11 @@ module.exports = function (content) {
442
442
  }
443
443
  const tarRoot = subPackage.tarRoot || subPackage.root || ''
444
444
  const srcRoot = subPackage.srcRoot || subPackage.root || ''
445
- if (!tarRoot || subPackagesCfg[tarRoot]) return callback()
445
+ if (!tarRoot) return callback()
446
446
 
447
447
  context = path.join(context, srcRoot)
448
448
  const otherConfig = getOtherConfig(subPackage)
449
- subPackagesCfg[tarRoot] = {
449
+ subPackagesCfg[tarRoot] = subPackagesCfg[tarRoot] || {
450
450
  root: tarRoot,
451
451
  pages: []
452
452
  }
@@ -20,7 +20,7 @@ module.exports = function getRulesRunner ({
20
20
  wx: require('./json/wx')
21
21
  }
22
22
  }
23
- const spec = specMap[type]?.[srcMode]?.({ warn, error })
23
+ const spec = specMap[type] && specMap[type][srcMode] && specMap[type][srcMode]({ warn, error })
24
24
  if (spec && spec.supportedModes.indexOf(mode) > -1) {
25
25
  const normalizeTest = spec.normalizeTest
26
26
  const mainRules = mainKey ? spec[mainKey] : spec
@@ -59,9 +59,7 @@ function MpxEvent (layer) {
59
59
  this.sendEvent(this.targetElement, 'tap', event)
60
60
  }
61
61
  this.sendEvent = (targetElement, type, event) => {
62
- // eslint-disable-next-line no-undef
63
- const touchEvent = new TouchEvent(type, {
64
- view: window,
62
+ const touchEvent = new CustomEvent(type, {
65
63
  bubbles: true,
66
64
  cancelable: true
67
65
  })
@@ -271,7 +271,11 @@ function getMessage (messages, locale, fallbackLocale, key) {
271
271
 
272
272
  function resolve (messages, locale, key) {
273
273
  if (messages && messages[locale] && key) {
274
- return getPathValue(messages[locale], key)
274
+ var format = getPathValue(messages[locale], key)
275
+ if (format == null) {
276
+ format = messages[locale][key]
277
+ }
278
+ return format
275
279
  }
276
280
  }
277
281
 
@@ -34,7 +34,7 @@ module.exports = function (template, {
34
34
 
35
35
  if (ctorType === 'app') {
36
36
  const { el } = webConfig
37
- const idName = el?.match(/#(.*)/)?.[1] || 'app'
37
+ const idName = (el && el.match(/#(.*)/) && el.match(/#(.*)/)[1]) || 'app'
38
38
  template = {
39
39
  tag: 'template',
40
40
  content: `<div id="${idName}"><mpx-keep-alive><router-view></router-view></mpx-keep-alive></div>`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.9.21",
3
+ "version": "2.9.26",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"
@@ -83,5 +83,5 @@
83
83
  "engines": {
84
84
  "node": ">=14.14.0"
85
85
  },
86
- "gitHead": "0ed5fa50016bd13a170c38619cfa9cbcc352ba23"
86
+ "gitHead": "0abcc7e543b5c4c4af14b2154b78b15c1f571160"
87
87
  }