@mpxjs/webpack-plugin 2.7.55 → 2.7.56
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.
|
@@ -274,7 +274,7 @@ module.exports = function (content) {
|
|
|
274
274
|
})
|
|
275
275
|
// 对于通过.mpx文件声明的独立分包,默认将其自身的script block视为init module
|
|
276
276
|
if (queryObj.independent === true) queryObj.independent = result
|
|
277
|
-
getJSONContent(parts.json || {}, this, (err, content) => {
|
|
277
|
+
getJSONContent(parts.json || {}, result, this, (err, content) => {
|
|
278
278
|
callback(err, result, content)
|
|
279
279
|
})
|
|
280
280
|
} else {
|
package/lib/loader.js
CHANGED
|
@@ -91,7 +91,7 @@ module.exports = function (content) {
|
|
|
91
91
|
|
|
92
92
|
async.waterfall([
|
|
93
93
|
(callback) => {
|
|
94
|
-
getJSONContent(parts.json || {}, loaderContext, (err, content) => {
|
|
94
|
+
getJSONContent(parts.json || {}, null, loaderContext, (err, content) => {
|
|
95
95
|
if (err) return callback(err)
|
|
96
96
|
if (parts.json) parts.json.content = content
|
|
97
97
|
callback()
|
package/lib/native-loader.js
CHANGED
|
@@ -4,6 +4,7 @@ module.exports = class FixDescriptionInfoPlugin {
|
|
|
4
4
|
apply (resolver) {
|
|
5
5
|
resolver.hooks.result.tap('FixDescriptionInfoPlugin', (request) => {
|
|
6
6
|
const { path: resourcePath } = request
|
|
7
|
+
if (!resourcePath) return
|
|
7
8
|
const segments = resourcePath.split(path.sep)
|
|
8
9
|
let rootIndex = -1
|
|
9
10
|
for (let i = segments.length - 1; i >= 0; i--) {
|
|
@@ -3,14 +3,18 @@ const evalJSONJS = require('./eval-json-js')
|
|
|
3
3
|
const resolve = require('./resolve')
|
|
4
4
|
const async = require('async')
|
|
5
5
|
const { JSON_JS_EXT } = require('./const')
|
|
6
|
+
const path = require('path')
|
|
6
7
|
|
|
7
|
-
module.exports = function getJSONContent (json, loaderContext, callback) {
|
|
8
|
+
module.exports = function getJSONContent (json, filename, loaderContext, callback) {
|
|
8
9
|
if (!loaderContext._compiler) return callback(null, '{}')
|
|
9
10
|
const fs = loaderContext._compiler.inputFileSystem
|
|
11
|
+
filename = filename || loaderContext.resourcePath
|
|
12
|
+
const context = path.dirname(filename)
|
|
13
|
+
|
|
10
14
|
async.waterfall([
|
|
11
15
|
(callback) => {
|
|
12
16
|
if (json.src) {
|
|
13
|
-
resolve(
|
|
17
|
+
resolve(context, json.src, loaderContext, (err, result) => {
|
|
14
18
|
if (err) return callback(err)
|
|
15
19
|
const { rawResourcePath: resourcePath } = parseRequest(result)
|
|
16
20
|
fs.readFile(resourcePath, (err, content) => {
|
|
@@ -27,7 +31,7 @@ module.exports = function getJSONContent (json, loaderContext, callback) {
|
|
|
27
31
|
callback(null, {
|
|
28
32
|
content: json.content,
|
|
29
33
|
useJSONJS: json.useJSONJS,
|
|
30
|
-
filename
|
|
34
|
+
filename
|
|
31
35
|
})
|
|
32
36
|
}
|
|
33
37
|
},
|
package/lib/web/processJSON.js
CHANGED
|
@@ -139,7 +139,7 @@ module.exports = function (json, {
|
|
|
139
139
|
mode,
|
|
140
140
|
env
|
|
141
141
|
})
|
|
142
|
-
getJSONContent(parts.json || {}, loaderContext, (err, content) => {
|
|
142
|
+
getJSONContent(parts.json || {}, result, loaderContext, (err, content) => {
|
|
143
143
|
callback(err, result, content)
|
|
144
144
|
})
|
|
145
145
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.56",
|
|
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": "ec0c4c8e63558622a0bd4cf4cf1ca5aafaae1499"
|
|
84
84
|
}
|