neo-cmp-cli 1.2.13 → 1.2.15
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 +1 -1
- package/src/module/main.js +4 -4
- package/src/plugins/AddNeoRequirePlugin.js +3 -12
- package/src/template/antd-custom-cmp-template/package.json +1 -1
- package/src/template/develop/neo-custom-cmp-template/package.json +1 -1
- package/src/template/echarts-custom-cmp-template/package.json +1 -1
- package/src/template/neo-custom-cmp-template/package.json +1 -1
- package/src/template/react-custom-cmp-template/package.json +1 -1
- package/src/template/react-ts-custom-cmp-template/package.json +1 -1
- package/src/template/vue2-custom-cmp-template/package.json +1 -1
package/package.json
CHANGED
package/src/module/main.js
CHANGED
|
@@ -110,9 +110,9 @@ module.exports = {
|
|
|
110
110
|
curConfig.webpack.plugins &&
|
|
111
111
|
Array.isArray(curConfig.webpack.plugins)
|
|
112
112
|
) {
|
|
113
|
-
curConfig.webpack.plugins.push(new AddNeoRequirePlugin());
|
|
113
|
+
curConfig.webpack.plugins.push(new AddNeoRequirePlugin({verbose: true}));
|
|
114
114
|
} else {
|
|
115
|
-
curConfig.webpack.plugins = [new AddNeoRequirePlugin()];
|
|
115
|
+
curConfig.webpack.plugins = [new AddNeoRequirePlugin({verbose: true})];
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
// 添加 内置 Neo 的 externals 配置
|
|
@@ -230,9 +230,9 @@ module.exports = {
|
|
|
230
230
|
curConfig.webpack.plugins &&
|
|
231
231
|
Array.isArray(curConfig.webpack.plugins)
|
|
232
232
|
) {
|
|
233
|
-
curConfig.webpack.plugins.push(new AddNeoRequirePlugin());
|
|
233
|
+
curConfig.webpack.plugins.push(new AddNeoRequirePlugin({verbose: true}));
|
|
234
234
|
} else {
|
|
235
|
-
curConfig.webpack.plugins = [new AddNeoRequirePlugin()];
|
|
235
|
+
curConfig.webpack.plugins = [new AddNeoRequirePlugin({verbose: true})];
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
// 添加 内置 Neo 的 externals 配置
|
|
@@ -5,6 +5,8 @@ const { ConcatSource } = require('webpack-sources');
|
|
|
5
5
|
* 备注:用于实现和 Neo 平台共享依赖
|
|
6
6
|
*/
|
|
7
7
|
class AddNeoRequirePlugin {
|
|
8
|
+
key = 'AddNeoRequirePlugin';
|
|
9
|
+
|
|
8
10
|
constructor(options = {}) {
|
|
9
11
|
this.options = {
|
|
10
12
|
// 是否启用详细日志
|
|
@@ -17,9 +19,6 @@ class AddNeoRequirePlugin {
|
|
|
17
19
|
skipPatterns: options.skipPatterns || [/\.map$/, /\.LICENSE\.txt$/, /\.html$/],
|
|
18
20
|
...options
|
|
19
21
|
};
|
|
20
|
-
|
|
21
|
-
// 记录已处理的文件,避免重复处理
|
|
22
|
-
this.processedFiles = new Set();
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
/**
|
|
@@ -78,7 +77,7 @@ class AddNeoRequirePlugin {
|
|
|
78
77
|
log(message, level = 'info') {
|
|
79
78
|
if (this.options.verbose || level === 'error') {
|
|
80
79
|
const prefix = `[AddNeoRequirePlugin]`;
|
|
81
|
-
console[level](
|
|
80
|
+
console[level](`/n${prefix} ${message}`);
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
|
|
@@ -106,13 +105,6 @@ class AddNeoRequirePlugin {
|
|
|
106
105
|
continue;
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
// 检查是否已经处理过
|
|
110
|
-
if (this.processedFiles.has(filename)) {
|
|
111
|
-
this.log(`跳过文件: ${filename} (已处理过)`);
|
|
112
|
-
skippedCount++;
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
108
|
// 获取文件内容
|
|
117
109
|
const source = asset.source();
|
|
118
110
|
const content = typeof source === 'string' ? source : source.toString();
|
|
@@ -133,7 +125,6 @@ class AddNeoRequirePlugin {
|
|
|
133
125
|
|
|
134
126
|
// 执行注入
|
|
135
127
|
this.injectNeoRequire(compilation, filename, content);
|
|
136
|
-
this.processedFiles.add(filename);
|
|
137
128
|
processedCount++;
|
|
138
129
|
|
|
139
130
|
this.log(`成功处理文件: ${filename}`);
|