akfun 3.1.5 → 3.1.9
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 -2
- package/src/dev-server.js +4 -4
- package/src/initData/akfun-package.json +0 -1
- package/src/utils/getProjectDir.js +12 -2
- package/src/webpack/loaderUtils.js +4 -1
- package/src/webpack/vue-loader.conf.js +1 -0
- package/src/webpack/webpack.base.conf.js +6 -6
- package/src/webpack/webpack.dev.conf.js +3 -1
- package/src/webpack/webpack.library.conf.js +2 -1
- package/src/webpack/webpack.prod.conf.js +2 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akfun",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.9",
|
|
4
4
|
"description": "前端脚手架:支持Vue技术栈和react技术栈",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"前端工程",
|
|
@@ -113,7 +113,6 @@
|
|
|
113
113
|
"inquirer": "^8.2.0",
|
|
114
114
|
"mini-css-extract-plugin": "^2.5.3",
|
|
115
115
|
"css-minimizer-webpack-plugin": "^3.4.1",
|
|
116
|
-
"monaco-editor-webpack-plugin": "6.0.0",
|
|
117
116
|
"sass": "^1.49.7",
|
|
118
117
|
"open": "^8.4.0",
|
|
119
118
|
"ora": "^4.0.4",
|
package/src/dev-server.js
CHANGED
|
@@ -127,10 +127,10 @@ module.exports = function (akfunConfig, _consoleTag) {
|
|
|
127
127
|
console.info(
|
|
128
128
|
`当前运行脚本:\n ${projPath}${filename}.js\n当前运行样式[可能不存在]:\n${projPath}${filename}.css`
|
|
129
129
|
);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
// 是否自动打开浏览器并跳转到第一个入口页面
|
|
131
|
+
if (!config.dev.closeHtmlWebpackPlugin && autoOpenBrowser) {
|
|
132
|
+
open(`${projPath}${filename}.html`, { wait: true });
|
|
133
|
+
}
|
|
134
134
|
}
|
|
135
135
|
server = app.listen(port);
|
|
136
136
|
_resolve();
|
|
@@ -7,10 +7,20 @@ module.exports = (_projectDir) => {
|
|
|
7
7
|
curProjectDir.push(resolveToCurrentRoot('./src'));
|
|
8
8
|
} else if (isArray(_projectDir)) {
|
|
9
9
|
_projectDir.forEach((dir) => {
|
|
10
|
-
|
|
10
|
+
if (dir.indexOf('/') === 0) {
|
|
11
|
+
// 判断是否是绝对路径
|
|
12
|
+
curProjectDir.push(dir);
|
|
13
|
+
} else {
|
|
14
|
+
curProjectDir.push(resolveToCurrentRoot(dir));
|
|
15
|
+
}
|
|
11
16
|
});
|
|
12
17
|
} else if (isString(_projectDir)) {
|
|
13
|
-
|
|
18
|
+
if (_projectDir.indexOf('/') === 0) {
|
|
19
|
+
// 判断是否是绝对路径
|
|
20
|
+
curProjectDir.push(_projectDir);
|
|
21
|
+
} else {
|
|
22
|
+
curProjectDir.push(resolveToCurrentRoot(_projectDir));
|
|
23
|
+
}
|
|
14
24
|
}
|
|
15
25
|
return curProjectDir;
|
|
16
26
|
};
|
|
@@ -44,7 +44,10 @@ exports.cssLoaders = function (options) {
|
|
|
44
44
|
return options.cssLoaderUrl;
|
|
45
45
|
}
|
|
46
46
|
// Don't handle `node_modules` urls
|
|
47
|
-
if (
|
|
47
|
+
if (
|
|
48
|
+
resourcePath.includes('node_modules') ||
|
|
49
|
+
(options.cssLoaderUrlDir && resourcePath.includes(options.cssLoaderUrlDir))
|
|
50
|
+
) {
|
|
48
51
|
return true;
|
|
49
52
|
}
|
|
50
53
|
return false;
|
|
@@ -6,6 +6,7 @@ const isProduction = process.NODE_ENV === 'production';
|
|
|
6
6
|
module.exports = {
|
|
7
7
|
loaders: utils.cssLoaders({
|
|
8
8
|
cssLoaderUrl: config.webpack.cssLoaderUrl, // 用于自定义css-loader配置项[url]
|
|
9
|
+
cssLoaderUrlDir: config.webpack.cssLoaderUrlDir, // 用于设置css-loader配置项[url]的生效目录
|
|
9
10
|
sourceMap: isProduction // 生产环境sourceMap是true
|
|
10
11
|
? config.build.productionSourceMap
|
|
11
12
|
: config.dev.cssSourceMap,
|
|
@@ -101,8 +101,8 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
],
|
|
104
|
+
// exclude: /node_modules/,
|
|
104
105
|
include: curProjectDir, // [resolve('src')],
|
|
105
|
-
exclude: /node_modules/
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
test: /\.(jsx?)$/,
|
|
@@ -112,8 +112,8 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
|
|
|
112
112
|
options: babelConfig
|
|
113
113
|
}
|
|
114
114
|
],
|
|
115
|
+
// exclude: /node_modules/,
|
|
115
116
|
include: curProjectDir, // [resolve('src')],
|
|
116
|
-
exclude: /node_modules/
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
// 图片资源
|
|
@@ -163,8 +163,8 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
|
|
|
163
163
|
{
|
|
164
164
|
test: /\.(js|ts|tsx|jsx|vue|css|html)$/,
|
|
165
165
|
loader: 'params-replace-loader',
|
|
166
|
+
// exclude: [/node_modules/, resolve('src/mock/data')], // 排除不需要进行校验的文件夹
|
|
166
167
|
include: curProjectDir, // [resolve('src')],
|
|
167
|
-
exclude: [/node_modules/, resolve('src/mock/data')], // 排除不需要进行校验的文件夹
|
|
168
168
|
options: config.envParams
|
|
169
169
|
},
|
|
170
170
|
{
|
|
@@ -243,7 +243,7 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
|
|
|
243
243
|
// context: resolve('src'),
|
|
244
244
|
extensions: ['ts', 'tsx'],
|
|
245
245
|
// include: curProjectDir, // [resolve('src')],
|
|
246
|
-
exclude: 'node_modules',
|
|
246
|
+
// exclude: 'node_modules',
|
|
247
247
|
cache: true,
|
|
248
248
|
fix: config.settings.enableESLintFix || false,
|
|
249
249
|
formatter: require('eslint-friendly-formatter'),
|
|
@@ -255,7 +255,7 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
|
|
|
255
255
|
new ESLintPlugin({
|
|
256
256
|
extensions: ['js', 'jsx'],
|
|
257
257
|
// include: curProjectDir, // [resolve('src')],
|
|
258
|
-
exclude: 'node_modules',
|
|
258
|
+
// exclude: 'node_modules',
|
|
259
259
|
cache: true,
|
|
260
260
|
fix: config.settings.enableESLintFix || false,
|
|
261
261
|
formatter: require('eslint-friendly-formatter'),
|
|
@@ -267,7 +267,7 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
|
|
|
267
267
|
new ESLintPlugin({
|
|
268
268
|
extensions: ['vue'],
|
|
269
269
|
// include: curProjectDir, // [resolve('src')],
|
|
270
|
-
exclude: 'node_modules',
|
|
270
|
+
// exclude: 'node_modules',
|
|
271
271
|
cache: true,
|
|
272
272
|
fix: config.settings.enableESLintFix || false,
|
|
273
273
|
formatter: require('eslint-friendly-formatter'),
|
|
@@ -7,6 +7,7 @@ const projectConfig = require('../config/index');
|
|
|
7
7
|
const getBaseWebpackConfig = require('./webpack.base.conf');
|
|
8
8
|
const entrys2htmlWebpackPlugin = require('../utils/entrys2htmlWebpackPlugin');
|
|
9
9
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
10
|
+
const config = require('../config');
|
|
10
11
|
// const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
|
11
12
|
|
|
12
13
|
module.exports = (akfunConfig) => {
|
|
@@ -30,7 +31,8 @@ module.exports = (akfunConfig) => {
|
|
|
30
31
|
rules: utils.styleLoaders({
|
|
31
32
|
sourceMap: curEnvConfig.cssSourceMap,
|
|
32
33
|
environment: 'prod', // 'dev': 不会将css单独提取出来
|
|
33
|
-
cssLoaderUrl: config.webpack.cssLoaderUrl
|
|
34
|
+
cssLoaderUrl: config.webpack.cssLoaderUrl,
|
|
35
|
+
cssLoaderUrlDir: config.webpack.cssLoaderUrlDir
|
|
34
36
|
})
|
|
35
37
|
},
|
|
36
38
|
// devtool: '#cheap-module-eval-source-map', // 本地开发环境中的取值
|
|
@@ -32,7 +32,8 @@ module.exports = (akfunConfig) => {
|
|
|
32
32
|
rules: utils.styleLoaders({
|
|
33
33
|
sourceMap: curEnvConfig.productionSourceMap,
|
|
34
34
|
environment: 'prod',
|
|
35
|
-
cssLoaderUrl: config.webpack.cssLoaderUrl
|
|
35
|
+
cssLoaderUrl: config.webpack.cssLoaderUrl,
|
|
36
|
+
cssLoaderUrlDir: config.webpack.cssLoaderUrlDir
|
|
36
37
|
})
|
|
37
38
|
},
|
|
38
39
|
devtool: curEnvConfig.productionSourceMap ? curEnvConfig.devtool || 'source-map' : false, // 线上生成环境
|
|
@@ -7,7 +7,6 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // 替换extrac
|
|
|
7
7
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
8
8
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
9
9
|
const CompressionWebpackPlugin = require('compression-webpack-plugin');
|
|
10
|
-
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
|
|
11
10
|
|
|
12
11
|
const utils = require('./loaderUtils');
|
|
13
12
|
const { resolve } = require('../utils/pathUtils'); // 统一路径解析
|
|
@@ -47,7 +46,8 @@ module.exports = (akfunConfig) => {
|
|
|
47
46
|
rules: utils.styleLoaders({
|
|
48
47
|
sourceMap: curEnvConfig.productionSourceMap,
|
|
49
48
|
environment: 'prod',
|
|
50
|
-
cssLoaderUrl: config.webpack.cssLoaderUrl
|
|
49
|
+
cssLoaderUrl: config.webpack.cssLoaderUrl,
|
|
50
|
+
cssLoaderUrlDir: config.webpack.cssLoaderUrlDir
|
|
51
51
|
})
|
|
52
52
|
},
|
|
53
53
|
devtool: curEnvConfig.productionSourceMap ? curEnvConfig.devtool || 'source-map' : false, // 线上生成环境
|
|
@@ -132,11 +132,6 @@ module.exports = (akfunConfig) => {
|
|
|
132
132
|
);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
// 是否开启
|
|
136
|
-
if (curEnvConfig.openMonacoWebpackPlugin) {
|
|
137
|
-
webpackProdConfig.plugins.push(new MonacoWebpackPlugin());
|
|
138
|
-
}
|
|
139
|
-
|
|
140
135
|
if (curEnvConfig.bundleAnalyzerReport) {
|
|
141
136
|
webpackProdConfig.plugins.push(new BundleAnalyzerPlugin());
|
|
142
137
|
}
|