@mpxjs/webpack-plugin 2.7.55 → 2.7.57

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()
@@ -117,7 +117,7 @@ module.exports = function (content) {
117
117
  getJSONContent({
118
118
  src: typeResourceMap.json,
119
119
  useJSONJS
120
- }, this, callback)
120
+ }, null, this, callback)
121
121
  }, (content, callback) => {
122
122
  let json
123
123
  try {
@@ -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 })
@@ -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(loaderContext.context, json.src, loaderContext, (err, result) => {
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: loaderContext.resourcePath
34
+ filename
31
35
  })
32
36
  }
33
37
  },
@@ -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.55",
3
+ "version": "2.7.57",
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": "988b3f83c36ba5280ee7d050fc8b610ae4f3ad86"
83
+ "gitHead": "d880e6a7cbce97d3b8cce3468619683d7c062837"
84
84
  }