@mpxjs/webpack-plugin 2.7.0-beta.11 → 2.7.0-beta.12

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.
@@ -1,6 +1,6 @@
1
1
  const ModuleDependency = require('webpack/lib/dependencies/ModuleDependency')
2
2
  const makeSerializable = require('webpack/lib/util/makeSerializable')
3
- const InitFragment = require("webpack/lib//InitFragment");
3
+ const InitFragment = require('webpack/lib//InitFragment')
4
4
 
5
5
  class CommonJsVariableDependency extends ModuleDependency {
6
6
  constructor (request, name) {
package/lib/extractor.js CHANGED
@@ -51,6 +51,10 @@ module.exports.pitch = async function (remainingRequest) {
51
51
  }).join('\n')
52
52
  }
53
53
 
54
+ let resultSource = DEFAULT_RESULT_SOURCE
55
+
56
+ if (typeof content !== 'string') return resultSource
57
+
54
58
  const extractedInfo = {
55
59
  content,
56
60
  index
@@ -61,8 +65,6 @@ module.exports.pitch = async function (remainingRequest) {
61
65
  extractedInfo
62
66
  })
63
67
 
64
- let resultSource = DEFAULT_RESULT_SOURCE
65
-
66
68
  const { buildInfo } = this._module
67
69
 
68
70
  // 如果importModule子模块中包含动态特性,比如动态添加入口和静态资源输出路径,则当前extractor模块不可缓存
package/lib/index.js CHANGED
@@ -345,8 +345,9 @@ class MpxWebpackPlugin {
345
345
  if (module.resource) {
346
346
  const { queryObj } = parseRequest(module.resource)
347
347
  isIndependent = queryObj.isIndependent
348
- } else if (module._identifier && /\|isIndependent\|/.test(module._identifier)) {
349
- isIndependent = true
348
+ } else {
349
+ const identifier = module.identifier()
350
+ isIndependent = /\|isIndependent\|/.test(identifier)
350
351
  }
351
352
  return !isIndependent
352
353
  },
@@ -723,9 +724,14 @@ class MpxWebpackPlugin {
723
724
  module.resource = addQuery(module.resource, queryObj)
724
725
  }
725
726
  }
726
- } else if (module._identifier && isIndependent) {
727
- // ContextModule只在独立分包的情况下添加分包标记,其余默认不添加
728
- module._identifier += `|isIndependent|${currentPackageRoot}`
727
+ } else if (isIndependent) {
728
+ // ContextModule和RawModule只在独立分包的情况下添加分包标记,其余默认不添加
729
+ const postfix = `|isIndependent|${currentPackageRoot}`
730
+ if (module._identifier) {
731
+ module._identifier += postfix
732
+ } else if (module.identifierStr) {
733
+ module.identifierStr += postfix
734
+ }
729
735
  }
730
736
  return rawAddModule.call(compilation, module, callback)
731
737
  }
package/lib/loader.js CHANGED
@@ -228,9 +228,9 @@ module.exports = function (content) {
228
228
 
229
229
  output += `if (!global.i18n) {
230
230
  global.i18n = ${JSON.stringify({
231
- locale: i18n.locale,
232
- version: 0
233
- })}
231
+ locale: i18n.locale,
232
+ version: 0
233
+ })}
234
234
  global.i18nMethods = ${i18nMethodsVar}
235
235
  }\n`
236
236
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.7.0-beta.11",
3
+ "version": "2.7.0-beta.12",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"
@@ -77,5 +77,5 @@
77
77
  "@types/babel-traverse": "^6.25.4",
78
78
  "@types/babel-types": "^7.0.4"
79
79
  },
80
- "gitHead": "136ce251b0e3763197707e64a25306dc1532db1b"
80
+ "gitHead": "d112dccb287436f8719007884cf90610ab5569ff"
81
81
  }