akfun 3.0.5 → 3.1.1
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 +2 -2
- package/src/utils/gitClone.js +4 -4
- package/src/webpack/loaderUtils.js +2 -2
- package/src/webpack/vue-loader.conf.js +1 -0
- package/src/webpack/webpack.base.conf.js +7 -1
- package/src/webpack/webpack.dev.conf.js +2 -1
- package/src/webpack/webpack.library.conf.js +2 -1
- package/src/webpack/webpack.prod.conf.js +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akfun",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "前端脚手架:支持Vue技术栈和react技术栈",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"前端工程",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"express": "^4.17.2",
|
|
106
106
|
"figlet": "^1.5.2",
|
|
107
107
|
"file-loader": "^6.2.0",
|
|
108
|
-
"git-clone": "
|
|
108
|
+
"git-clone": "0.1.0",
|
|
109
109
|
"glob": "^7.2.0",
|
|
110
110
|
"html-loader": "^3.1.0",
|
|
111
111
|
"html-webpack-plugin": "^5.5.0",
|
package/src/utils/gitClone.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const ora = require('ora');
|
|
3
|
-
const
|
|
3
|
+
const gitClone = require('git-clone');
|
|
4
4
|
const rm = require('rimraf').sync;
|
|
5
5
|
const { resolveToCurrentRoot } = require('../utils/pathUtils');
|
|
6
|
-
const {curConsoleTag} = require(
|
|
6
|
+
const { curConsoleTag } = require('./akfunParams');
|
|
7
7
|
|
|
8
8
|
function _gitClone(gitUrl, dir, callback, _consoleTag) {
|
|
9
9
|
const consoleTag = _consoleTag || curConsoleTag;
|
|
10
10
|
const spinner = ora(`${consoleTag}正在加载项目模板...`).start();
|
|
11
|
-
|
|
11
|
+
gitClone(
|
|
12
12
|
gitUrl,
|
|
13
13
|
resolveToCurrentRoot(dir),
|
|
14
14
|
{
|
|
@@ -20,7 +20,7 @@ function _gitClone(gitUrl, dir, callback, _consoleTag) {
|
|
|
20
20
|
spinner.succeed(`${consoleTag}项目模板加载完成!`);
|
|
21
21
|
callback();
|
|
22
22
|
} else {
|
|
23
|
-
|
|
23
|
+
spinner.fail(err);
|
|
24
24
|
callback(err);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -39,10 +39,10 @@ exports.cssLoaders = function (options) {
|
|
|
39
39
|
// url: false, // enables/disables url()/image-set() functions handling
|
|
40
40
|
url: {
|
|
41
41
|
filter: (url, resourcePath) => {
|
|
42
|
-
|
|
42
|
+
// 自定义配置优先
|
|
43
43
|
if (options.cssLoaderUrl !== undefined) {
|
|
44
44
|
return options.cssLoaderUrl;
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
// Don't handle `node_modules` urls
|
|
47
47
|
if (resourcePath.includes('node_modules')) {
|
|
48
48
|
return true;
|
|
@@ -5,6 +5,7 @@ const isProduction = process.NODE_ENV === 'production';
|
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
7
|
loaders: utils.cssLoaders({
|
|
8
|
+
cssLoaderUrl: config.webpack.cssLoaderUrl, // 用于自定义css-loader配置项[url]
|
|
8
9
|
sourceMap: isProduction // 生产环境sourceMap是true
|
|
9
10
|
? config.build.productionSourceMap
|
|
10
11
|
: config.dev.cssSourceMap,
|
|
@@ -193,7 +193,7 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
|
|
|
193
193
|
// 优先使用执行环境中的配置
|
|
194
194
|
if (curEnvConfig.ignoreNodeModules !== undefined) {
|
|
195
195
|
const allowList = curEnvConfig.allowList || curWebpackConfig.allowList;
|
|
196
|
-
const externals = curEnvConfig.externals ||
|
|
196
|
+
const externals = curEnvConfig.externals || curWebpackConfig.external || [];
|
|
197
197
|
webpackConfig.externals = curEnvConfig.ignoreNodeModules
|
|
198
198
|
? [
|
|
199
199
|
nodeExternals({
|
|
@@ -305,5 +305,11 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
|
|
|
305
305
|
);
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
+
// 判断是否有自定义plugins
|
|
309
|
+
if (curWebpackConfig.plugins && Array.isArray(curWebpackConfig.plugins)) {
|
|
310
|
+
// 添加自定义webpack插件
|
|
311
|
+
webpackConfig.plugins.concat(curWebpackConfig.plugins);
|
|
312
|
+
}
|
|
313
|
+
|
|
308
314
|
return webpackConfig;
|
|
309
315
|
};
|
|
@@ -29,7 +29,8 @@ module.exports = (akfunConfig) => {
|
|
|
29
29
|
module: {
|
|
30
30
|
rules: utils.styleLoaders({
|
|
31
31
|
sourceMap: curEnvConfig.cssSourceMap,
|
|
32
|
-
environment: 'prod' // 'dev': 不会将css单独提取出来
|
|
32
|
+
environment: 'prod', // 'dev': 不会将css单独提取出来
|
|
33
|
+
cssLoaderUrl: config.webpack.cssLoaderUrl
|
|
33
34
|
})
|
|
34
35
|
},
|
|
35
36
|
// devtool: '#cheap-module-eval-source-map', // 本地开发环境中的取值
|
|
@@ -31,7 +31,8 @@ module.exports = (akfunConfig) => {
|
|
|
31
31
|
module: {
|
|
32
32
|
rules: utils.styleLoaders({
|
|
33
33
|
sourceMap: curEnvConfig.productionSourceMap,
|
|
34
|
-
environment: 'prod'
|
|
34
|
+
environment: 'prod',
|
|
35
|
+
cssLoaderUrl: config.webpack.cssLoaderUrl
|
|
35
36
|
})
|
|
36
37
|
},
|
|
37
38
|
devtool: curEnvConfig.productionSourceMap ? curEnvConfig.devtool || 'source-map' : false, // 线上生成环境
|
|
@@ -46,7 +46,8 @@ module.exports = (akfunConfig) => {
|
|
|
46
46
|
module: {
|
|
47
47
|
rules: utils.styleLoaders({
|
|
48
48
|
sourceMap: curEnvConfig.productionSourceMap,
|
|
49
|
-
environment: 'prod'
|
|
49
|
+
environment: 'prod',
|
|
50
|
+
cssLoaderUrl: config.webpack.cssLoaderUrl
|
|
50
51
|
})
|
|
51
52
|
},
|
|
52
53
|
devtool: curEnvConfig.productionSourceMap ? curEnvConfig.devtool || 'source-map' : false, // 线上生成环境
|
|
@@ -137,7 +138,7 @@ module.exports = (akfunConfig) => {
|
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
if (curEnvConfig.bundleAnalyzerReport) {
|
|
140
|
-
|
|
141
|
+
webpackConfig.plugins.push(...curWebpackConfig.plugins);
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
return webpackProdConfig;
|