@mpxjs/webpack-plugin 2.7.43 → 2.7.44
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 +16 -4
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -812,12 +812,24 @@ class MpxWebpackPlugin {
|
|
|
812
812
|
// 因为文件缓存的存在,前面hack identifier的行为对于从文件缓存中创建得到的module并不生效,因此需要在回调中进行二次hack处理
|
|
813
813
|
if (err) return rawCallback(err)
|
|
814
814
|
hackModuleIdentifier(module)
|
|
815
|
-
rawCallback(null, module)
|
|
815
|
+
return rawCallback(null, module)
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
818
|
return rawAddModule.call(compilation, module, callback)
|
|
819
819
|
}
|
|
820
820
|
|
|
821
|
+
// hack process https://github.com/webpack/webpack/issues/16045
|
|
822
|
+
const _handleModuleBuildAndDependenciesRaw = compilation._handleModuleBuildAndDependencies
|
|
823
|
+
|
|
824
|
+
compilation._handleModuleBuildAndDependencies = (originModule, module, recursive, callback) => {
|
|
825
|
+
const rawCallback = callback
|
|
826
|
+
callback = (err) => {
|
|
827
|
+
if (err) return rawCallback(err)
|
|
828
|
+
return rawCallback(null, module)
|
|
829
|
+
}
|
|
830
|
+
return _handleModuleBuildAndDependenciesRaw.call(compilation, originModule, module, recursive, callback)
|
|
831
|
+
}
|
|
832
|
+
|
|
821
833
|
const rawEmitAsset = compilation.emitAsset
|
|
822
834
|
|
|
823
835
|
compilation.emitAsset = (file, source, assetInfo) => {
|
|
@@ -950,7 +962,7 @@ class MpxWebpackPlugin {
|
|
|
950
962
|
return true
|
|
951
963
|
})
|
|
952
964
|
|
|
953
|
-
const requireAsyncHandler = (expr, members) => {
|
|
965
|
+
const requireAsyncHandler = (expr, members, args) => {
|
|
954
966
|
if (members[0] === 'async') {
|
|
955
967
|
let request = expr.arguments[0].value
|
|
956
968
|
const range = expr.arguments[0].range
|
|
@@ -970,10 +982,10 @@ class MpxWebpackPlugin {
|
|
|
970
982
|
const dep = new CommonJsAsyncDependency(request, range)
|
|
971
983
|
parser.state.current.addDependency(dep)
|
|
972
984
|
}
|
|
985
|
+
if (args) parser.walkExpressions(args)
|
|
973
986
|
return true
|
|
974
987
|
} else {
|
|
975
988
|
compilation.errors.push(new Error(`The require async JS [${request}] need to declare subpackage name by root`))
|
|
976
|
-
return true
|
|
977
989
|
}
|
|
978
990
|
}
|
|
979
991
|
}
|
|
@@ -990,7 +1002,7 @@ class MpxWebpackPlugin {
|
|
|
990
1002
|
.tap({
|
|
991
1003
|
name: 'MpxWebpackPlugin',
|
|
992
1004
|
stage: -1000
|
|
993
|
-
}, (expr, calleeMembers, callExpr) => requireAsyncHandler(callExpr, calleeMembers))
|
|
1005
|
+
}, (expr, calleeMembers, callExpr) => requireAsyncHandler(callExpr, calleeMembers, expr.arguments))
|
|
994
1006
|
|
|
995
1007
|
// hack babel polyfill global
|
|
996
1008
|
parser.hooks.statementIf.tap('MpxWebpackPlugin', (expr) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.44",
|
|
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": "306aee23bc55c7f1af58b8de0c6e6394370c88d4"
|
|
84
84
|
}
|