@mpxjs/webpack-plugin 2.8.7 → 2.8.9
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 +3 -1
- package/lib/json-compiler/helper.js +2 -1
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -167,6 +167,7 @@ class MpxWebpackPlugin {
|
|
|
167
167
|
options.webConfig = options.webConfig || {}
|
|
168
168
|
options.partialCompile = options.mode !== 'web' && options.partialCompile
|
|
169
169
|
options.retryRequireAsync = options.retryRequireAsync || false
|
|
170
|
+
options.enableAliRequireAsync = options.enableAliRequireAsync || false
|
|
170
171
|
this.options = options
|
|
171
172
|
// Hack for buildDependencies
|
|
172
173
|
const rawResolveBuildDependencies = FileSystemInfo.prototype.resolveBuildDependencies
|
|
@@ -575,6 +576,7 @@ class MpxWebpackPlugin {
|
|
|
575
576
|
useRelativePath: this.options.useRelativePath,
|
|
576
577
|
removedChunks: [],
|
|
577
578
|
forceProxyEventRules: this.options.forceProxyEventRules,
|
|
579
|
+
enableAliRequireAsync: this.options.enableAliRequireAsync,
|
|
578
580
|
pathHash: (resourcePath) => {
|
|
579
581
|
if (this.options.pathHashMode === 'relative' && this.options.projectRoot) {
|
|
580
582
|
return hash(path.relative(this.options.projectRoot, resourcePath))
|
|
@@ -985,7 +987,7 @@ class MpxWebpackPlugin {
|
|
|
985
987
|
// 删除root query
|
|
986
988
|
request = addQuery(request, {}, false, ['root'])
|
|
987
989
|
// 目前仅wx支持require.async,其余平台使用CommonJsAsyncDependency进行模拟抹平
|
|
988
|
-
if (mpx.mode === 'wx') {
|
|
990
|
+
if (mpx.mode === 'wx' || (mpx.mode === 'ali' && mpx.enableAliRequireAsync)) {
|
|
989
991
|
const dep = new DynamicEntryDependency(request, 'export', '', queryObj.root, '', context, range, {
|
|
990
992
|
isRequireAsync: true,
|
|
991
993
|
retryRequireAsync: !!this.options.retryRequireAsync
|
|
@@ -16,6 +16,7 @@ module.exports = function createJSONHelper ({ loaderContext, emitWarning, custom
|
|
|
16
16
|
const pathHash = mpx.pathHash
|
|
17
17
|
const getOutputPath = mpx.getOutputPath
|
|
18
18
|
const mode = mpx.mode
|
|
19
|
+
const enableAliRequireAsync = mpx.enableAliRequireAsync
|
|
19
20
|
|
|
20
21
|
const isUrlRequest = r => isUrlRequestRaw(r, root, externals)
|
|
21
22
|
const urlToRequest = r => loaderUtils.urlToRequest(r)
|
|
@@ -53,7 +54,7 @@ module.exports = function createJSONHelper ({ loaderContext, emitWarning, custom
|
|
|
53
54
|
// 删除root query
|
|
54
55
|
resource = addQuery(resource, {}, false, ['root'])
|
|
55
56
|
// 目前只有微信支持分包异步化
|
|
56
|
-
if (mode === 'wx') tarRoot = queryObj.root
|
|
57
|
+
if (mode === 'wx' || (mode === 'ali' && enableAliRequireAsync)) tarRoot = queryObj.root
|
|
57
58
|
}
|
|
58
59
|
const parsed = path.parse(resourcePath)
|
|
59
60
|
const ext = parsed.ext
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.9",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": ">=14.14.0"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "cf78b0055150a47233adb8ef76ee5fd9eb74f4c4"
|
|
86
86
|
}
|