akfun 5.3.0 → 5.3.2
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/dev-server.js +12 -2
package/package.json
CHANGED
package/src/dev-server.js
CHANGED
|
@@ -14,7 +14,7 @@ const getDevWebpackConfig = require('./webpack/webpack.dev.conf');
|
|
|
14
14
|
const { curConsoleTag } = require('./utils/akfunParams');
|
|
15
15
|
|
|
16
16
|
// 构建脚本:一般用于构建开发环境的代码(包含热更新、接口代理等功能)
|
|
17
|
-
module.exports = function (akfunConfig, _consoleTag) {
|
|
17
|
+
module.exports = function (akfunConfig, _consoleTag, callbackFunc) {
|
|
18
18
|
const consoleTag = _consoleTag || curConsoleTag;
|
|
19
19
|
// 获取项目配置文件
|
|
20
20
|
let config = getProjectConfig(akfunConfig);
|
|
@@ -118,19 +118,29 @@ module.exports = function (akfunConfig, _consoleTag) {
|
|
|
118
118
|
// 获取第一个入口文件
|
|
119
119
|
const filename = entryFiles[0];
|
|
120
120
|
const consoleInfo = curEnvConfig.consoleInfo || '当前运行脚本';
|
|
121
|
+
const firstAssetUrl = `${projPath}${filename}.js`
|
|
121
122
|
|
|
122
123
|
if (curEnvConfig.cssExtract || curEnvConfig.cssExtract === undefined) {
|
|
123
124
|
console.info(
|
|
124
125
|
`${consoleInfo}:\n ${projPath}${filename}.js\n当前可用样式[可能不存在]:\n${projPath}${filename}.css`
|
|
125
126
|
);
|
|
126
127
|
} else {
|
|
127
|
-
console.info(`${consoleInfo}:\n ${
|
|
128
|
+
console.info(`${consoleInfo}:\n ${firstAssetUrl}`);
|
|
128
129
|
}
|
|
129
130
|
// 是否自动打开浏览器并跳转到第一个入口页面
|
|
130
131
|
if (!curEnvConfig.closeHtmlWebpackPlugin && autoOpenBrowser) {
|
|
131
132
|
open(`${projPath}${filename}.html`, { wait: true });
|
|
132
133
|
}
|
|
133
134
|
}
|
|
135
|
+
|
|
136
|
+
// 如果用户传入了回调函数,则执行回调函数
|
|
137
|
+
if (callbackFunc) {
|
|
138
|
+
callbackFunc({
|
|
139
|
+
config: curEnvConfig,
|
|
140
|
+
url: firstAssetUrl,
|
|
141
|
+
port: port
|
|
142
|
+
});
|
|
143
|
+
}
|
|
134
144
|
};
|
|
135
145
|
|
|
136
146
|
if (curEnvConfig.https) {
|