Skip to content

Commit 00fd155

Browse files
committed
chore: update deps & fixed bug
1 parent b23ae75 commit 00fd155

File tree

8 files changed

+885
-214
lines changed

8 files changed

+885
-214
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
},
3939
"license": "MIT",
4040
"peerDependencies": {
41-
"@micro-app/core": "^0.3.25"
41+
"@micro-app/core": "^0.3.30"
4242
},
4343
"devDependencies": {
4444
"@micro-app/plugin-deploy": "^0.0.7",
@@ -48,7 +48,7 @@
4848
"webpack": "^4.42.1"
4949
},
5050
"dependencies": {
51-
"@micro-app/cli": "^0.3.15",
52-
"@micro-app/plugin-webpack": "^0.0.12"
51+
"@micro-app/cli": "^0.3.17",
52+
"@micro-app/plugin-webpack": "^0.0.13"
5353
}
5454
}

src/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
module.exports = {
44
BUILT_IN: Symbol.for('built-in'),
5-
SKIP_TARGET: 'pure',
5+
SKIP_CONTEXT: [ '--pure-webpack-unified-config' ], // 通过此配置,可禁用 plugin-webpack 中的默认配置
66
};

src/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ const service = require('./utils/createService');
66
let IPLUGIN_ID;
77
module.exports = function(api, vueConfig) {
88
if (api.$isMicroAppPluginAPI) { // micro-app plugin
9-
const registerMethod = require('./utils/registerMethod');
10-
registerMethod(api);
119
IPLUGIN_ID = api.id;
1210
} else { // vue-cli plugin
1311
const plugin = IPLUGIN_ID ? service.findPlugin(IPLUGIN_ID) : service.plugins[0]; // 随便取个plugin
@@ -44,3 +42,11 @@ module.exports = function(api, vueConfig) {
4442
}
4543
}
4644
};
45+
46+
// 注册
47+
module.exports.registerMethod = {
48+
modifyVueConfig: {
49+
type: 'MODIFY',
50+
description: 'modify vue config.',
51+
},
52+
};

src/service/chainConfig.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ module.exports = function chainDefault(api, vueConfig, _mapi) {
6060
if (staticPaths.length) {
6161
const CopyWebpackPlugin = tryRequire('copy-webpack-plugin');
6262
if (CopyWebpackPlugin) {
63+
const outputDir = webpackChain.output.get('path');
6364
webpackChain
64-
.plugin('copy')
65+
.plugin('copyEx')
6566
.use(CopyWebpackPlugin, [ staticPaths.map(publicDir => {
6667
return {
6768
from: publicDir,
69+
to: outputDir,
6870
toType: 'dir',
6971
ignore: [ '.*' ],
7072
};
@@ -79,6 +81,6 @@ module.exports = function chainDefault(api, vueConfig, _mapi) {
7981

8082
// webpack 所有配置合入
8183
api.chainWebpack(webpackChain => {
82-
return _mapi.resolveChainableWebpackConfig(webpackChain);
84+
return _mapi.resolveWebpackChain(webpackChain);
8385
});
8486
};

src/utils/createService.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
'use strict';
22

33
const { service } = require('@micro-app/cli');
4-
const { SKIP_TARGET } = require('../constants');
5-
6-
service.context.target = SKIP_TARGET;
4+
const { SKIP_CONTEXT } = require('../constants');
5+
service.mergeContext(SKIP_CONTEXT);
76

87
// 提前注册
98
const registerWebpackPlugin = require('./registerWebpackPlugin');

src/utils/registerMethod.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

test/cliPlugin.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('Vue CLI Plugin', () => {
66

77
const plugin = require('../src');
88

9-
it('plugin', async () => {
9+
it('plugin', () => {
1010
const api = {
1111
service: {
1212
plugins: [],

yarn.lock

Lines changed: 866 additions & 184 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)