@mpxjs/webpack-plugin 2.7.0-beta.6 → 2.7.0-beta.7

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/loader.js CHANGED
@@ -195,6 +195,14 @@ module.exports = function (content) {
195
195
  })
196
196
  }
197
197
 
198
+ const moduleGraph = this._compilation.moduleGraph
199
+
200
+ const issuer = moduleGraph.getIssuer(this._module)
201
+
202
+ if (issuer) {
203
+ return callback(new Error(`Current ${ctorType} [${this.resourcePath}] is issued by [${issuer.resource}], which is not allowed!`))
204
+ }
205
+
198
206
  if (ctorType === 'app') {
199
207
  const appName = getEntryName(this)
200
208
  this._module.addPresentationalDependency(new AppEntryDependency(resourcePath, appName))
package/lib/wxs/loader.js CHANGED
@@ -47,7 +47,24 @@ module.exports = function () {
47
47
  }
48
48
 
49
49
  const outputOptions = {
50
- filename
50
+ filename,
51
+ // 避免输出的wxs中包含es语法
52
+ environment: {
53
+ // The environment supports arrow functions ('() => { ... }').
54
+ arrowFunction: false,
55
+ // The environment supports BigInt as literal (123n).
56
+ bigIntLiteral: false,
57
+ // The environment supports const and let for variable declarations.
58
+ const: false,
59
+ // The environment supports destructuring ('{ a, b } = obj').
60
+ destructuring: false,
61
+ // The environment supports an async import() function to import EcmaScript modules.
62
+ dynamicImport: false,
63
+ // The environment supports 'for of' iteration ('for (const x of array) { ... }').
64
+ forOf: false,
65
+ // The environment supports ECMAScript Module syntax to import ECMAScript modules (import ... from '...').
66
+ module: false
67
+ }
51
68
  }
52
69
  // wxs文件必须经过pre-loader
53
70
  const request = '!!' + this.remainingRequest
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.7.0-beta.6",
3
+ "version": "2.7.0-beta.7",
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": "c04233503af0b1c7b4410fd03582d9dd883182d9"
80
+ "gitHead": "1b04682d96f1ed2658c73d6b976cf5b7684e808c"
81
81
  }