@mpxjs/webpack-plugin 2.7.0-beta.0 → 2.7.0-beta.1

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 +11 -7
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -54,6 +54,7 @@ const isProductionLikeMode = options => {
54
54
  }
55
55
 
56
56
  const isStaticModule = module => {
57
+ if (!module.resource) return false
57
58
  const { queryObj } = parseRequest(module.resource)
58
59
  let isStatic = queryObj.isStatic || false
59
60
  if (module.loaders) {
@@ -574,10 +575,14 @@ class MpxWebpackPlugin {
574
575
  currentResourceMap = resourceMap[packageName]
575
576
  }
576
577
 
577
- let alreadyOutputed = currentResourceMap[resourcePath]
578
- if (!alreadyOutputed) {
579
- if (outputPath) {
580
- outputPath = toPosix(path.join(packageRoot, outputPath))
578
+ let alreadyOutputed = false
579
+ if (outputPath) {
580
+ outputPath = toPosix(path.join(packageRoot, outputPath))
581
+ // 如果之前已经进行过输出,则不需要重复进行
582
+ if (currentResourceMap[resourcePath] === outputPath) {
583
+ alreadyOutputed = true
584
+ } else {
585
+ currentResourceMap[resourcePath] = outputPath
581
586
  // 输出冲突检测只有page需要
582
587
  if (resourceType === 'page') {
583
588
  for (let key in currentResourceMap) {
@@ -587,10 +592,9 @@ class MpxWebpackPlugin {
587
592
  }
588
593
  }
589
594
  }
590
- currentResourceMap[resourcePath] = outputPath
591
- } else {
592
- currentResourceMap[resourcePath] = true
593
595
  }
596
+ } else if (!currentResourceMap[resourcePath]) {
597
+ currentResourceMap[resourcePath] = true
594
598
  }
595
599
 
596
600
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.7.0-beta.0",
3
+ "version": "2.7.0-beta.1",
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": "b0c87a3d77b02c8ab81ad079f4f7c69b65be5c87"
80
+ "gitHead": "7f65fd0558d535329892d99ddaeebe675127314b"
81
81
  }