@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.
- package/lib/dependencies/CommonJsVariableDependency.js +1 -1
- package/lib/extractor.js +4 -2
- package/lib/index.js +11 -5
- package/lib/loader.js +3 -3
- package/package.json +2 -2
|
@@ -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(
|
|
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
|
|
349
|
-
|
|
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 (
|
|
727
|
-
// ContextModule只在独立分包的情况下添加分包标记,其余默认不添加
|
|
728
|
-
|
|
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
|
-
|
|
232
|
-
|
|
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.
|
|
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": "
|
|
80
|
+
"gitHead": "d112dccb287436f8719007884cf90610ab5569ff"
|
|
81
81
|
}
|