@mpxjs/webpack-plugin 2.8.6 → 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 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
@@ -3,7 +3,7 @@ const TAG_NAME = 'map'
3
3
  module.exports = function ({ print }) {
4
4
  const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false })
5
5
  const aliEventLogError = print({ platform: 'ali', tag: TAG_NAME, isError: true, type: 'event' })
6
- const aliPropValueWarningLog = print({ platform: 'ali', tag: TAG_NAME, isError: true, type: 'value-attr-uniform' })
6
+ const aliPropValueWarningLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'value-attr-uniform' })
7
7
  const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false })
8
8
  const baiduEventLogError = print({ platform: 'baidu', tag: TAG_NAME, isError: true, type: 'event' })
9
9
  const jdPropLog = print({ platform: 'jd', tag: TAG_NAME, isError: false })
@@ -28,13 +28,9 @@ export default function processOption (
28
28
  }
29
29
  }
30
30
 
31
- Vue.directive('animation', (el, binding) => {
32
- return animation(el, binding)
33
- })
31
+ Vue.directive('animation', animation)
34
32
 
35
- Vue.filter('transRpxStyle', style => {
36
- return transRpxStyle(style)
37
- })
33
+ Vue.filter('transRpxStyle', transRpxStyle)
38
34
 
39
35
  const routes = []
40
36
 
@@ -213,7 +209,6 @@ export default function processOption (
213
209
  }
214
210
  if (currentPage) {
215
211
  currentPage.mpxPageStatus = 'hide'
216
- currentPage.onHide && currentPage.onHide()
217
212
  }
218
213
  } else {
219
214
  if (global.__mpxAppCbs && global.__mpxAppCbs.show) {
@@ -225,7 +220,6 @@ export default function processOption (
225
220
  }
226
221
  if (currentPage) {
227
222
  currentPage.mpxPageStatus = 'show'
228
- currentPage.onShow && currentPage.onShow()
229
223
  }
230
224
  }
231
225
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.8.6",
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": "c4261c7ea5a16ee3ceaac78afad09e5e0b35d39a"
85
+ "gitHead": "cf78b0055150a47233adb8ef76ee5fd9eb74f4c4"
86
86
  }