@mpxjs/mpx-cli-service 2.1.19 → 2.1.21

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/Service.js +25 -1
  2. package/package.json +2 -2
package/lib/Service.js CHANGED
@@ -1,9 +1,33 @@
1
1
  const Service = require('@vue/cli-service')
2
-
3
2
  const { getServerBundle } = require('@mpxjs/cli-shared-utils')
3
+ const Config = require('webpack-chain')
4
+ const PluginAPI = require('@vue/cli-service/lib/PluginAPI')
4
5
 
5
6
  process.env.CI = 't'
6
7
 
8
+ Service.prototype.resolveChainableWebpackConfig = function () {
9
+ const chainableConfig = new Config()
10
+ // apply chains
11
+ this.webpackChainFns.forEach(fn => {
12
+ const res = fn(chainableConfig)
13
+ if (res instanceof Promise) {
14
+ this.webpackChainPromises = this.webpackChainPromises || []
15
+ this.webpackChainPromises.push(res)
16
+ }
17
+ })
18
+ return chainableConfig
19
+ }
20
+
21
+ const originResolveWebpackConfig = PluginAPI.prototype.resolveWebpackConfig
22
+ PluginAPI.prototype.resolveWebpackConfig = async function (chainableConfig) {
23
+ chainableConfig = chainableConfig || this.resolveChainableWebpackConfig()
24
+ if (this.service.webpackChainPromises) {
25
+ await Promise.all(this.service.webpackChainPromises)
26
+ }
27
+ const res = originResolveWebpackConfig.call(this, chainableConfig)
28
+ return res
29
+ }
30
+
7
31
  module.exports = Service
8
32
 
9
33
  module.exports.getServerBundle = getServerBundle
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@mpxjs/mpx-cli-service",
3
- "version": "2.1.19",
3
+ "version": "2.1.21",
4
4
  "description": "local service for mpx-cli project",
5
5
  "main": "lib/Service.js",
6
6
  "bin": {
7
7
  "mpx-cli-service": "bin/mpx-cli-service.js"
8
8
  },
9
9
  "dependencies": {
10
- "@mpxjs/cli-shared-utils": "^2.1.19",
10
+ "@mpxjs/cli-shared-utils": "^2.1.21",
11
11
  "@vue/cli-service": "^5.0.0",
12
12
  "@vue/cli-shared-utils": "^5.0.4",
13
13
  "minimist": "^1.2.5"