akfun 5.2.2 → 5.2.3
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/build2esm.js +1 -1
- package/src/build2node.js +1 -1
- package/src/rollup/build.js +11 -12
- package/src/rollup/rollup.config.js +1 -1
- package/src/rollup/rollup.node.config.js +5 -4
package/package.json
CHANGED
package/src/build2esm.js
CHANGED
package/src/build2node.js
CHANGED
package/src/rollup/build.js
CHANGED
|
@@ -63,18 +63,17 @@ module.exports = function (config, envConfig, _rollupConfig, _consoleTag) {
|
|
|
63
63
|
|
|
64
64
|
if (envConfig && envConfig.output) {
|
|
65
65
|
curRollupConfig.output = envConfig.output;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
66
|
+
}
|
|
67
|
+
if (compress && isArray(curRollupConfig.output)) {
|
|
68
|
+
curRollupConfig.output.map((outputItem) => {
|
|
69
|
+
if (!outputItem.plugins) {
|
|
70
|
+
outputItem.plugins = [terser()];
|
|
71
|
+
} else {
|
|
72
|
+
outputItem.plugins.push(terser());
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
} else if (compress && isObject(curRollupConfig.output) && !curRollupConfig.output.plugins) {
|
|
76
|
+
curRollupConfig.output.plugins = [terser()];
|
|
78
77
|
}
|
|
79
78
|
const spinner = ora(`${consoleTag}开启${buildFormat}模块构建模式...`).start();
|
|
80
79
|
rollupBuildFunc(curRollupConfig, config).then(() => {
|
|
@@ -14,7 +14,7 @@ const { resolve } = require('../utils/pathUtils'); // 统一路径解析
|
|
|
14
14
|
* 备注:node 模块构建不需要使用 babel,也不需要处理css、图片、svg 等文件。
|
|
15
15
|
* @param {*} curConfig 当前项目配置
|
|
16
16
|
* @param {*} curEnvConfig 当前环境配置
|
|
17
|
-
*
|
|
17
|
+
*
|
|
18
18
|
* 支持的配置项目(curEnvConfig)
|
|
19
19
|
* - type: 项目构建类型(ts、js)
|
|
20
20
|
* - format: 构建格式(esm、cjs)
|
|
@@ -76,12 +76,13 @@ module.exports = function (curConfig, curEnvConfig) {
|
|
|
76
76
|
output: {
|
|
77
77
|
dir: curEnvConfig.outDir || resolve('dist'),
|
|
78
78
|
format: buildFormat, // which can be one of "amd", "cjs", "system", "es", "iife" or "umd".
|
|
79
|
-
preserveModules:
|
|
79
|
+
preserveModules:
|
|
80
|
+
curEnvConfig.preserveModules !== undefined ? curEnvConfig.preserveModules : true, // 关键:保留原始模块结构,不合并文件
|
|
80
81
|
preserveModulesRoot: 'src', // 指定模块根目录
|
|
81
82
|
exports: 'auto', // 自动处理导出(适配 ES 模块的默认导出/命名导出)
|
|
82
83
|
generatedCode: 'es2015', // 使用现代 JavaScript 语法生成代码
|
|
83
|
-
entryFileNames: '[name].js'
|
|
84
|
+
entryFileNames: '[name].js'
|
|
84
85
|
// interop: 'auto' // 自动处理 CJS/ES 模块互操作(如 __esModule 标记)
|
|
85
|
-
}
|
|
86
|
+
}
|
|
86
87
|
};
|
|
87
88
|
};
|