akfun 5.2.10 → 5.2.11

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akfun",
3
- "version": "5.2.10",
3
+ "version": "5.2.11",
4
4
  "description": "前端脚手架:支持Vue技术栈和react技术栈",
5
5
  "keywords": [
6
6
  "前端工程",
@@ -39,16 +39,21 @@ module.exports = (_curEnvConfig, _akfunConfig, buildMode = 'build') => {
39
39
  // 获取当前项目目录
40
40
  const curProjectDir = getProjectDir(curWebpackConfig.projectDir);
41
41
 
42
+ // 避免引用 babelConfig 的原始数据,导致数据污染
43
+ const curBabelConfig = {
44
+ ...babelConfig
45
+ };
46
+
42
47
  // 剔除掉 babel-loader 不需要的配置
43
- delete babelConfig.extensions;
44
-
48
+ delete curBabelConfig.extensions;
49
+
45
50
  // 判断是否有自定义 Babel plugins
46
51
  if (isArray(curWebpackConfig.babelPlugins)) {
47
52
  // 添加自定义babel插件
48
- babelConfig.plugins.push(...curWebpackConfig.babelPlugins);
53
+ curBabelConfig.plugins.push(...curWebpackConfig.babelPlugins);
49
54
  } else if (isFunction(curWebpackConfig.babelPlugins)) {
50
55
  // 处理自定义babel插件
51
- curWebpackConfig.babelPlugins(babelConfig.plugins);
56
+ curWebpackConfig.babelPlugins(curBabelConfig.plugins);
52
57
  }
53
58
 
54
59
  // 获取缓存目录路径
@@ -112,7 +117,7 @@ module.exports = (_curEnvConfig, _akfunConfig, buildMode = 'build') => {
112
117
  {
113
118
  loader: 'babel-loader',
114
119
  options: {
115
- ...babelConfig,
120
+ ...curBabelConfig,
116
121
  // Babel 缓存配置
117
122
  cacheDirectory: true, // 启用缓存
118
123
  cacheCompression: false, // 不压缩缓存文件以提升性能
@@ -143,7 +148,7 @@ module.exports = (_curEnvConfig, _akfunConfig, buildMode = 'build') => {
143
148
  {
144
149
  loader: 'babel-loader',
145
150
  options: {
146
- ...babelConfig,
151
+ ...curBabelConfig,
147
152
  // Babel 缓存配置
148
153
  cacheDirectory: true, // 启用缓存
149
154
  cacheCompression: false, // 不压缩缓存文件以提升性能