akfun 3.1.7 → 3.2.0
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akfun",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "前端脚手架:支持Vue技术栈和react技术栈",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"前端工程",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"@rollup/plugin-image": "^2.1.1",
|
|
74
74
|
"@rollup/plugin-json": "^4.1.0",
|
|
75
75
|
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
76
|
+
"@rollup/plugin-typescript": "^8.3.1",
|
|
76
77
|
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
|
77
78
|
"@typescript-eslint/parser": "^5.10.2",
|
|
78
79
|
"@vue/compiler-sfc": "^3.2.29",
|
|
@@ -113,7 +114,6 @@
|
|
|
113
114
|
"inquirer": "^8.2.0",
|
|
114
115
|
"mini-css-extract-plugin": "^2.5.3",
|
|
115
116
|
"css-minimizer-webpack-plugin": "^3.4.1",
|
|
116
|
-
"monaco-editor-webpack-plugin": "6.0.0",
|
|
117
117
|
"sass": "^1.49.7",
|
|
118
118
|
"open": "^8.4.0",
|
|
119
119
|
"ora": "^4.0.4",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// rollup.config.js
|
|
2
2
|
const { babel } = require('@rollup/plugin-babel');
|
|
3
3
|
const { nodeResolve } = require('@rollup/plugin-node-resolve'); // 支持node中的文件导入
|
|
4
|
+
// const jsx = require('rollup-plugin-jsx'); // 用于处理jsx
|
|
5
|
+
const typescript = require('@rollup/plugin-typescript'); // 支持ts
|
|
4
6
|
const commonjs = require('@rollup/plugin-commonjs'); // 识别cmd模块
|
|
5
7
|
const vue = require('rollup-plugin-vue');
|
|
6
8
|
const json = require('@rollup/plugin-json'); // 识别json类型文件
|
|
@@ -20,9 +22,9 @@ const cssnano = require('cssnano');
|
|
|
20
22
|
const { resolveToCurrentRoot, resolveToCurrentDist } = require('../utils/pathUtils'); // 统一路径解析
|
|
21
23
|
const babelConfig = require('./babel.config'); // Babel的配置文件
|
|
22
24
|
const curProjectConfig = require('./index'); // 引入当前项目配置文件
|
|
23
|
-
const {buildBanner} = require(
|
|
25
|
+
const { buildBanner } = require('../utils/akfunParams');
|
|
24
26
|
|
|
25
|
-
module.exports = function(fileName, akfunConfig) {
|
|
27
|
+
module.exports = function (fileName, akfunConfig) {
|
|
26
28
|
const curConfig = akfunConfig || curProjectConfig;
|
|
27
29
|
// 获取用户配置的构建入口文件
|
|
28
30
|
let rollupInput = resolveToCurrentRoot('src/main.js');
|
|
@@ -50,7 +52,9 @@ module.exports = function(fileName, akfunConfig) {
|
|
|
50
52
|
nodeResolve({
|
|
51
53
|
extensions: curConfig.webpack.resolve.extensions
|
|
52
54
|
}),
|
|
55
|
+
typescript(),
|
|
53
56
|
babel(babelConfig), // 备注,需要先babel()再commjs()
|
|
57
|
+
// jsx( {factory: 'React.createElement'} ),
|
|
54
58
|
vue(),
|
|
55
59
|
commonjs(),
|
|
56
60
|
postcss({
|
|
@@ -6,7 +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, //
|
|
9
|
+
cssLoaderUrlDir: config.webpack.cssLoaderUrlDir, // 用于设置css-loader配置项[url]的生效目录
|
|
10
10
|
sourceMap: isProduction // 生产环境sourceMap是true
|
|
11
11
|
? config.build.productionSourceMap
|
|
12
12
|
: config.dev.cssSourceMap,
|
|
@@ -101,8 +101,8 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
],
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
// exclude: /node_modules/,
|
|
105
|
+
include: curProjectDir // [resolve('src')],
|
|
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
|
-
|
|
116
|
-
|
|
115
|
+
// exclude: /node_modules/,
|
|
116
|
+
include: curProjectDir // [resolve('src')],
|
|
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,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'); // 统一路径解析
|
|
@@ -133,11 +132,6 @@ module.exports = (akfunConfig) => {
|
|
|
133
132
|
);
|
|
134
133
|
}
|
|
135
134
|
|
|
136
|
-
// 是否开启
|
|
137
|
-
if (curEnvConfig.openMonacoWebpackPlugin) {
|
|
138
|
-
webpackProdConfig.plugins.push(new MonacoWebpackPlugin());
|
|
139
|
-
}
|
|
140
|
-
|
|
141
135
|
if (curEnvConfig.bundleAnalyzerReport) {
|
|
142
136
|
webpackProdConfig.plugins.push(new BundleAnalyzerPlugin());
|
|
143
137
|
}
|