@mpxjs/webpack-plugin 2.7.13 → 2.7.14

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.
Files changed (2) hide show
  1. package/lib/index.js +19 -21
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -130,7 +130,7 @@ class MpxWebpackPlugin {
130
130
  })
131
131
  // 批量指定源码mode
132
132
  options.modeRules = options.modeRules || {}
133
- options.generateBuildMap = options.generateBuildMap || false
133
+ // options.generateBuildMap = options.generateBuildMap || false
134
134
  options.attributes = options.attributes || []
135
135
  options.externals = (options.externals || []).map((external) => {
136
136
  return externalsMap[external] || external
@@ -1130,6 +1130,23 @@ class MpxWebpackPlugin {
1130
1130
  }, () => {
1131
1131
  if (mpx.mode === 'web') return
1132
1132
 
1133
+ // if (this.options.generateBuildMap) {
1134
+ // const pagesMap = compilation.__mpx__.pagesMap
1135
+ // const componentsPackageMap = compilation.__mpx__.componentsMap
1136
+ // const componentsMap = Object.keys(componentsPackageMap).map(item => componentsPackageMap[item]).reduce((pre, cur) => {
1137
+ // return { ...pre, ...cur }
1138
+ // }, {})
1139
+ // const outputMap = JSON.stringify({ ...pagesMap, ...componentsMap })
1140
+ // compilation.assets['../outputMap.json'] = {
1141
+ // source: () => {
1142
+ // return outputMap
1143
+ // },
1144
+ // size: () => {
1145
+ // return Buffer.byteLength(outputMap, 'utf8')
1146
+ // }
1147
+ // }
1148
+ // }
1149
+
1133
1150
  const {
1134
1151
  globalObject,
1135
1152
  chunkLoadingGlobal
@@ -1353,7 +1370,7 @@ try {
1353
1370
 
1354
1371
  if (mpx.mode === 'web') {
1355
1372
  const mpxStyleOptions = queryObj.mpxStyleOptions
1356
- const firstLoader = toPosix(loaders[0] && loaders[0].loader) || ''
1373
+ const firstLoader = loaders[0] ? toPosix(loaders[0].loader) : ''
1357
1374
  const isPitcherRequest = firstLoader.includes('vue-loader/lib/loaders/pitcher')
1358
1375
  let cssLoaderIndex = -1
1359
1376
  let vueStyleLoaderIndex = -1
@@ -1390,25 +1407,6 @@ try {
1390
1407
  })
1391
1408
  })
1392
1409
 
1393
- compiler.hooks.emit.tap('MpxWebpackPlugin', (compilation) => {
1394
- if (this.options.generateBuildMap) {
1395
- const pagesMap = compilation.__mpx__.pagesMap
1396
- const componentsPackageMap = compilation.__mpx__.componentsMap
1397
- const componentsMap = Object.keys(componentsPackageMap).map(item => componentsPackageMap[item]).reduce((pre, cur) => {
1398
- return { ...pre, ...cur }
1399
- }, {})
1400
- const outputMap = JSON.stringify({ ...pagesMap, ...componentsMap })
1401
- compilation.assets['../outputMap.json'] = {
1402
- source: () => {
1403
- return outputMap
1404
- },
1405
- size: () => {
1406
- return Buffer.byteLength(outputMap, 'utf8')
1407
- }
1408
- }
1409
- }
1410
- })
1411
-
1412
1410
  const clearFileCache = () => {
1413
1411
  const fs = compiler.intermediateFileSystem
1414
1412
  const cacheLocation = compiler.options.cache.cacheLocation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.7.13",
3
+ "version": "2.7.14",
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": "be0a3699bcc617e76ffa6a27c0925da157335033"
83
+ "gitHead": "6490248041554fc3b6ffbe5a3acdb6f94d12331b"
84
84
  }