akfun 3.2.3 → 3.2.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 +1 -1
- package/src/build.js +5 -3
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -3,7 +3,7 @@ const rm = require('rimraf');
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
5
|
const webpack = require('webpack');
|
|
6
|
-
const {curConsoleTag} = require(
|
|
6
|
+
const { curConsoleTag } = require('./utils/akfunParams');
|
|
7
7
|
const checkVersion = require('./check-versions');
|
|
8
8
|
const projectConfig = require('./config/index'); // 引入当前项目配置文件
|
|
9
9
|
const defaultConfig = require('./config/default.config');
|
|
@@ -17,6 +17,7 @@ module.exports = function (BuildType, akfunConfig, _consoleTag) {
|
|
|
17
17
|
// 参数中的config配置优先级最高
|
|
18
18
|
config = deepMergeConfig(defaultConfig, akfunConfig);
|
|
19
19
|
}
|
|
20
|
+
let curEnvConfig = config.build;
|
|
20
21
|
// 检查当前npm版本号是否匹配
|
|
21
22
|
checkVersion();
|
|
22
23
|
const spinner = ora(`${consoleTag}开始构建...`).start();
|
|
@@ -26,6 +27,7 @@ module.exports = function (BuildType, akfunConfig, _consoleTag) {
|
|
|
26
27
|
if (BuildType && BuildType === 'lib') {
|
|
27
28
|
spinner.start(`${consoleTag}开始构建lib库...`);
|
|
28
29
|
webpackConfig = require('./webpack/webpack.library.conf')(config);
|
|
30
|
+
curEnvConfig = config.build2lib;
|
|
29
31
|
} else {
|
|
30
32
|
spinner.start(`${consoleTag}开始构建生产环境的代码...`);
|
|
31
33
|
webpackConfig = require('./webpack/webpack.prod.conf')(config);
|
|
@@ -36,10 +38,10 @@ module.exports = function (BuildType, akfunConfig, _consoleTag) {
|
|
|
36
38
|
* 使用 config.dev.NODE_ENV 作为当前的环境
|
|
37
39
|
*/
|
|
38
40
|
if (!process.NODE_ENV) {
|
|
39
|
-
process.NODE_ENV =
|
|
41
|
+
process.NODE_ENV = curEnvConfig.NODE_ENV; // 将运行环境设置为生产环境
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
rm(path.join(
|
|
44
|
+
rm(path.join(curEnvConfig.assetsRoot, curEnvConfig.assetsSubDirectory), (err) => {
|
|
43
45
|
if (err) throw err;
|
|
44
46
|
webpack(webpackConfig, (err, stats) => {
|
|
45
47
|
spinner.stop();
|