@mpxjs/webpack-plugin 2.9.54 → 2.9.55

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.
Files changed (2) hide show
  1. package/lib/index.js +13 -10
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -535,6 +535,16 @@ class MpxWebpackPlugin {
535
535
  }
536
536
  }
537
537
 
538
+ const checkDynamicEntryInfo = (compilation) => {
539
+ for (const packageName in mpx.dynamicEntryInfo) {
540
+ const entryMap = mpx.dynamicEntryInfo[packageName]
541
+ if (packageName !== 'main' && !entryMap.hasPage) {
542
+ // 引用未注册分包的所有资源
543
+ const resources = entryMap.entries.map(info => info.resource).join(',')
544
+ compilation.errors.push(new Error(`资源${resources}通过分包异步声明为${packageName}分包, 但${packageName}分包未注册或不存在相关页面!`))
545
+ }
546
+ }
547
+ }
538
548
  // 构建分包队列,在finishMake钩子当中最先执行,stage传递-1000
539
549
  compiler.hooks.finishMake.tapAsync({
540
550
  name: 'MpxWebpackPlugin',
@@ -549,17 +559,10 @@ class MpxWebpackPlugin {
549
559
  }
550
560
  ], (err) => {
551
561
  if (err) return callback(err)
552
- const checkDynamicEntryInfo = () => {
553
- for (const packageName in mpx.dynamicEntryInfo) {
554
- const entryMap = mpx.dynamicEntryInfo[packageName]
555
- if (packageName !== 'main' && !entryMap.hasPage) {
556
- // 引用未注册分包的所有资源
557
- const resources = entryMap.entries.map(info => info.resource).join(',')
558
- compilation.errors.push(new Error(`资源${resources}通过分包异步声明为${packageName}分包, 但${packageName}分包未注册或不存在相关页面!`))
559
- }
560
- }
562
+ if (mpx.supportRequireAsync && mpx.mode !== 'tt') {
563
+ // 字节小程序异步分包中不能包含page,忽略该检查
564
+ checkDynamicEntryInfo(compilation)
561
565
  }
562
- checkDynamicEntryInfo()
563
566
  callback()
564
567
  })
565
568
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.9.54",
3
+ "version": "2.9.55",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"
@@ -86,5 +86,5 @@
86
86
  "engines": {
87
87
  "node": ">=14.14.0"
88
88
  },
89
- "gitHead": "973791aa35b1846bb96efe421f7ce266b2531455"
89
+ "gitHead": "8e2e9dace226d48a91ff2a6dc2175c0a3be11d55"
90
90
  }