neo-cmp-cli 1.1.3 → 1.1.5
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/package.json
CHANGED
package/src/module/main.js
CHANGED
|
@@ -11,6 +11,7 @@ const getEntries = require('../cmpUtils/getEntries');
|
|
|
11
11
|
const getEntriesWithAutoRegister = require('../cmpUtils/getEntriesWithAutoRegister');
|
|
12
12
|
const previewCmp = require('./previewCmp');
|
|
13
13
|
const AddNeoRequirePlugin = require('../plugins/AddNeoRequirePlugin');
|
|
14
|
+
const { getExternalsByNeoCommonModules } = require('../neo/neoRequire');
|
|
14
15
|
// const { MFPlugins } = require('../utils/webpack.mf');
|
|
15
16
|
|
|
16
17
|
const getValue = (originValue, defaultValue) => {
|
|
@@ -108,6 +109,17 @@ module.exports = {
|
|
|
108
109
|
curConfig.webpack.plugins = [new AddNeoRequirePlugin()];
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
// 添加 externals 配置
|
|
113
|
+
const neoExternals = getExternalsByNeoCommonModules();
|
|
114
|
+
if (
|
|
115
|
+
curConfig.dev.externals &&
|
|
116
|
+
Array.isArray(curConfig.dev.externals)
|
|
117
|
+
) {
|
|
118
|
+
curConfig.dev.externals.push(...neoExternals);
|
|
119
|
+
} else {
|
|
120
|
+
curConfig.dev.externals = neoExternals;
|
|
121
|
+
}
|
|
122
|
+
|
|
111
123
|
akfun.dev(curConfig, consoleTag);
|
|
112
124
|
},
|
|
113
125
|
build: () => akfun.build('build', curConfig, consoleTag), // 构建脚本:生产环境
|
|
@@ -200,6 +212,17 @@ module.exports = {
|
|
|
200
212
|
curConfig.webpack.plugins = [new AddNeoRequirePlugin()];
|
|
201
213
|
}
|
|
202
214
|
|
|
215
|
+
// 添加 externals 配置
|
|
216
|
+
const neoExternals = getExternalsByNeoCommonModules();
|
|
217
|
+
if (
|
|
218
|
+
curConfig.build2lib.externals &&
|
|
219
|
+
Array.isArray(curConfig.build2lib.externals)
|
|
220
|
+
) {
|
|
221
|
+
curConfig.build2lib.externals.push(...neoExternals);
|
|
222
|
+
} else {
|
|
223
|
+
curConfig.build2lib.externals = neoExternals;
|
|
224
|
+
}
|
|
225
|
+
|
|
203
226
|
akfun.build('lib', curConfig, consoleTag, () => {
|
|
204
227
|
// 构建完成后,执行 publish2oss
|
|
205
228
|
publish2oss(
|
package/src/neo/neoRequire.js
CHANGED
|
@@ -17,6 +17,14 @@ const NeoCommonModules = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
// 根据 Neo 共享出来的依赖模块,获取 externals 配置
|
|
20
|
+
const getExternalsByNeoCommonModulesV1 = () => {
|
|
21
|
+
const neoExternals = {};
|
|
22
|
+
Object.keys(NeoCommonModules).forEach(moduleName => {
|
|
23
|
+
neoExternals[moduleName] = `commonjs ${moduleName}`;
|
|
24
|
+
});
|
|
25
|
+
return neoExternals;
|
|
26
|
+
};
|
|
27
|
+
|
|
20
28
|
const getExternalsByNeoCommonModules = () => {
|
|
21
29
|
return Object.keys(NeoCommonModules).map(moduleName => `commonjs ${moduleName}`);
|
|
22
30
|
};
|