akfun 3.0.0 → 3.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akfun",
3
- "version": "3.0.0",
3
+ "version": "3.0.5",
4
4
  "description": "前端脚手架:支持Vue技术栈和react技术栈",
5
5
  "keywords": [
6
6
  "前端工程",
@@ -112,6 +112,7 @@
112
112
  "http-proxy-middleware": "^2.0.2",
113
113
  "inquirer": "^8.2.0",
114
114
  "mini-css-extract-plugin": "^2.5.3",
115
+ "css-minimizer-webpack-plugin": "^3.4.1",
115
116
  "monaco-editor-webpack-plugin": "6.0.0",
116
117
  "sass": "^1.49.7",
117
118
  "open": "^8.4.0",
@@ -153,7 +154,7 @@
153
154
  "webpack-hot-middleware": "^2.25.1",
154
155
  "webpack-merge": "^5.8.0",
155
156
  "webpack-node-externals": "^3.0.0",
156
- "yargs": "^17.3.1"
157
+ "yargs": "^12.0.5"
157
158
  },
158
159
  "devDependencies": {
159
160
  "@commitlint/cli": "^16.1.0",
@@ -0,0 +1,138 @@
1
+ {
2
+ "name": "akfun",
3
+ "version": "1.2.12",
4
+ "description": "前端脚手架:支持Vue技术站和react技术栈",
5
+ "keywords": ["前端工程", "前端脚手架", "webpack"],
6
+ "author": "ldan@wibetter",
7
+ "license": "MIT",
8
+ "bin": {
9
+ "akfun": "./bin/akfun.js"
10
+ },
11
+ "main": "module/main.js",
12
+ "scripts": {
13
+ "akfun": "akfun",
14
+ "lint": "eslint --ext .js,.vue src",
15
+ "lintFix": "eslint --ext .js,.vue src --fix",
16
+ "format": "prettier --write \"src/**/**/*.{js,vue,tsx,ts,scss,json}\""
17
+ },
18
+ "files": ["bin/*", "module/*", "src/*"],
19
+ "husky": {
20
+ "hooks": {
21
+ "pre-commit": "lint-staged",
22
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
23
+ }
24
+ },
25
+ "lint-staged": {
26
+ "src/**/**/*.{js,vue,tsx,ts,scss,json}": ["eslint --ext --fix"],
27
+ "src/**/**/*.{js,vue,tsx,ts,scss,json}": ["prettier --write"]
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+http://git@github.com:wibetter/akfun.git"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/wibetter/akfun/issues"
35
+ },
36
+ "peerDependencies": {
37
+ "eslint": "^6.2.0 || ^7.0.0"
38
+ },
39
+ "dependencies": {
40
+ "del": "^3.0.0",
41
+ "figlet": "^1.2.0",
42
+ "glob": "^7.1.2",
43
+ "yargs": "^12.0.2",
44
+ "chalk": "^4.0.0",
45
+ "opn": "^6.0.0",
46
+ "ora": "^4.0.4",
47
+ "qs": "^6.9.4",
48
+ "rimraf": "^3.0.2",
49
+ "express": "^4.17.1",
50
+ "node-sass": "^4.14.1",
51
+ "portfinder": "^1.0.26",
52
+ "semver": "^7.3.2",
53
+ "shelljs": "^0.8.4",
54
+ "git-clone": "^0.1.0",
55
+ "webpack": "^4.43.0",
56
+ "webpack-bundle-analyzer": "^3.8.0",
57
+ "webpack-cli": "^3.3.11",
58
+ "webpack-dev-middleware": "^3.7.2",
59
+ "webpack-hot-middleware": "^2.25.0",
60
+ "webpack-merge": "^4.2.2",
61
+ "vue-loader": "^15.9.2",
62
+ "vue-style-loader": "^4.1.2",
63
+ "vue-template-compiler": "^2.6.11",
64
+ "cache-loader": "^4.1.0",
65
+ "compression-webpack-plugin": "^4.0.0",
66
+ "connect-history-api-fallback": "^1.6.0",
67
+ "copy-webpack-plugin": "^6.0.2",
68
+ "css-loader": "^3.5.3",
69
+ "es6-promise-polyfill": "^1.2.0",
70
+ "html-loader": "^1.1.0",
71
+ "html-webpack-plugin": "^4.3.0",
72
+ "http-proxy-middleware": "^1.0.4",
73
+ "autoprefixer": "^9.8.0",
74
+ "mini-css-extract-plugin": "^0.9.0",
75
+ "optimize-css-assets-webpack-plugin": "^5.0.3",
76
+ "params-replace-loader": "^1.1.6",
77
+ "progress-bar-webpack-plugin": "^2.1.0",
78
+ "sass-loader": "^8.0.2",
79
+ "sass-resources-loader": "^2.0.3",
80
+ "string-replace-loader": "^2.3.0",
81
+ "style-loader": "^1.2.1",
82
+ "eventsource-polyfill": "^0.9.6",
83
+ "friendly-errors-webpack-plugin": "^1.7.0",
84
+ "babel-loader": "^8.1.0",
85
+ "@babel/cli": "^7.10.1",
86
+ "@babel/core": "^7.10.2",
87
+ "@babel/polyfill": "^7.10.1",
88
+ "@babel/plugin-proposal-class-properties": "^7.10.1",
89
+ "@babel/plugin-proposal-decorators": "^7.10.1",
90
+ "@babel/plugin-proposal-export-namespace-from": "^7.10.1",
91
+ "@babel/plugin-proposal-function-sent": "^7.10.1",
92
+ "@babel/plugin-proposal-json-strings": "^7.10.1",
93
+ "@babel/plugin-proposal-numeric-separator": "^7.10.1",
94
+ "@babel/plugin-proposal-throw-expressions": "^7.10.1",
95
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
96
+ "@babel/plugin-syntax-import-meta": "^7.10.1",
97
+ "@babel/plugin-transform-runtime": "^7.10.1",
98
+ "@babel/preset-env": "^7.10.2",
99
+ "@babel/preset-react": "^7.10.1",
100
+ "@babel/register": "^7.10.1",
101
+ "babel-eslint": "^10.1.0",
102
+ "babel-plugin-import": "^1.13.0",
103
+ "eslint-loader": "^4.0.2",
104
+ "eslint": "^7.2.0",
105
+ "eslint-config-airbnb-base": "^14.1.0",
106
+ "eslint-friendly-formatter": "^4.0.1",
107
+ "eslint-import-resolver-webpack": "^0.12.1",
108
+ "eslint-plugin-html": "^6.0.2",
109
+ "eslint-plugin-import": "^2.21.1",
110
+ "eslint-plugin-prettier": "^3.1.3",
111
+ "eslint-plugin-react": "^7.20.0",
112
+ "eslint-plugin-vue": "^6.2.2",
113
+ "vue-eslint-parser": "^7.1.0",
114
+ "stylelint": "^13.6.0",
115
+ "stylelint-config-standard": "^20.0.0",
116
+ "stylelint-webpack-plugin": "^2.0.0",
117
+ "@mapbox/stylelint-processor-arbitrary-tags": "^0.3.0"
118
+ },
119
+ "devDependencies": {
120
+ "husky": "^4.2.5",
121
+ "lint-staged": "^10.2.9",
122
+ "prettier": "^2.0.5",
123
+ "@commitlint/cli": "^8.3.5",
124
+ "@commitlint/config-conventional": "^9.1.1"
125
+ },
126
+ "engines": {
127
+ "node": ">= 10.13.0",
128
+ "npm": ">= 6.4.1"
129
+ },
130
+ "browserslist": [
131
+ "> 1%",
132
+ "last 2 versions",
133
+ "not ie <= 8",
134
+ "iOS >= 8",
135
+ "Firefox >= 20",
136
+ "Android > 4.4"
137
+ ]
138
+ }
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "name": "akfun",
3
- "version": "1.2.12",
4
- "description": "前端脚手架:支持Vue技术站和react技术栈",
5
- "keywords": ["前端工程", "前端脚手架", "webpack"],
6
- "author": "ldan@wibetter",
3
+ "version": "3.0.0",
4
+ "description": "前端脚手架:支持Vue技术栈和react技术栈",
5
+ "keywords": [
6
+ "前端工程",
7
+ "前端脚手架",
8
+ "webpack",
9
+ "react项目脚手架",
10
+ "vue项目脚手架",
11
+ "lib库构建工具"
12
+ ],
13
+ "author": "wibetter",
7
14
  "license": "MIT",
8
15
  "bin": {
9
16
  "akfun": "./bin/akfun.js"
@@ -11,8 +18,6 @@
11
18
  "main": "module/main.js",
12
19
  "scripts": {
13
20
  "akfun": "akfun",
14
- "lint": "eslint --ext .js,.vue src",
15
- "lintFix": "eslint --ext .js,.vue src --fix",
16
21
  "format": "prettier --write \"src/**/**/*.{js,vue,tsx,ts,scss,json}\""
17
22
  },
18
23
  "files": ["bin/*", "module/*", "src/*"],
@@ -23,8 +28,7 @@
23
28
  }
24
29
  },
25
30
  "lint-staged": {
26
- "src/**/**/*.{js,vue,tsx,ts,scss,json}": ["eslint --ext --fix"],
27
- "src/**/**/*.{js,vue,tsx,ts,scss,json}": ["prettier --write"]
31
+ "src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}": ["prettier --write"]
28
32
  },
29
33
  "repository": {
30
34
  "type": "git",
@@ -34,96 +38,121 @@
34
38
  "url": "https://github.com/wibetter/akfun/issues"
35
39
  },
36
40
  "peerDependencies": {
37
- "eslint": "^6.2.0 || ^7.0.0"
41
+ "eslint": "^8.8.0",
42
+ "chalk": "^4.0.0",
43
+ "ora": "^4.0.4"
38
44
  },
39
45
  "dependencies": {
40
- "del": "^3.0.0",
41
- "figlet": "^1.2.0",
42
- "glob": "^7.1.2",
43
- "yargs": "^12.0.2",
46
+ "@babel/cli": "^7.17.0",
47
+ "@babel/core": "^7.17.0",
48
+ "@babel/plugin-proposal-class-properties": "^7.16.7",
49
+ "@babel/plugin-proposal-decorators": "^7.17.0",
50
+ "@babel/plugin-proposal-export-namespace-from": "^7.16.7",
51
+ "@babel/plugin-proposal-function-sent": "^7.16.7",
52
+ "@babel/plugin-proposal-json-strings": "^7.16.7",
53
+ "@babel/plugin-proposal-numeric-separator": "^7.16.7",
54
+ "@babel/plugin-proposal-throw-expressions": "^7.16.7",
55
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
56
+ "@babel/plugin-syntax-import-meta": "^7.10.4",
57
+ "@babel/plugin-transform-runtime": "^7.17.0",
58
+ "@babel/polyfill": "^7.10.1",
59
+ "@babel/preset-env": "^7.16.11",
60
+ "@babel/preset-react": "^7.16.7",
61
+ "@babel/preset-typescript": "^7.16.7",
62
+ "@babel/register": "^7.17.0",
63
+ "@mapbox/stylelint-processor-arbitrary-tags": "^0.4.0",
64
+ "@rollup/plugin-alias": "^3.1.9",
65
+ "@rollup/plugin-babel": "^5.3.0",
66
+ "@rollup/plugin-commonjs": "^21.0.1",
67
+ "@rollup/plugin-image": "^2.1.1",
68
+ "@rollup/plugin-json": "^4.1.0",
69
+ "@rollup/plugin-node-resolve": "^13.1.3",
70
+ "@typescript-eslint/eslint-plugin": "^5.10.2",
71
+ "@typescript-eslint/parser": "^5.10.2",
72
+ "@vue/compiler-sfc": "^3.2.29",
73
+ "@vue/eslint-config-typescript": "^10.0.0",
74
+ "autoprefixer": "^10.4.2",
75
+ "@babel/eslint-parser": "^7.17.0",
76
+ "babel-loader": "^8.2.3",
77
+ "babel-plugin-import": "^1.13.3",
44
78
  "chalk": "^4.0.0",
45
- "opn": "^6.0.0",
46
- "ora": "^4.0.4",
47
- "qs": "^6.9.4",
48
- "rimraf": "^3.0.2",
49
- "express": "^4.17.1",
50
- "node-sass": "^4.14.1",
51
- "portfinder": "^1.0.26",
52
- "semver": "^7.3.2",
53
- "shelljs": "^0.8.4",
54
- "git-clone": "^0.1.0",
55
- "webpack": "^4.43.0",
56
- "webpack-bundle-analyzer": "^3.8.0",
57
- "webpack-cli": "^3.3.11",
58
- "webpack-dev-middleware": "^3.7.2",
59
- "webpack-hot-middleware": "^2.25.0",
60
- "webpack-merge": "^4.2.2",
61
- "url-loader": "^4.1.0",
62
- "vue-loader": "^15.9.2",
63
- "vue-style-loader": "^4.1.2",
64
- "vue-template-compiler": "^2.6.11",
65
- "cache-loader": "^4.1.0",
66
- "compression-webpack-plugin": "^4.0.0",
79
+ "compression-webpack-plugin": "^9.2.0",
67
80
  "connect-history-api-fallback": "^1.6.0",
68
- "copy-webpack-plugin": "^6.0.2",
69
- "css-loader": "^3.5.3",
81
+ "copy-webpack-plugin": "^10.2.4",
82
+ "css-loader": "^6.6.0",
83
+ "cssnano": "^5.0.16",
84
+ "deepmerge": "^4.2.2",
85
+ "del": "^6.0.0",
70
86
  "es6-promise-polyfill": "^1.2.0",
71
- "html-loader": "^1.1.0",
72
- "html-webpack-plugin": "^4.3.0",
73
- "http-proxy-middleware": "^1.0.4",
74
- "autoprefixer": "^9.8.0",
75
- "mini-css-extract-plugin": "^0.9.0",
76
- "file-loader": "^6.0.0",
77
- "optimize-css-assets-webpack-plugin": "^5.0.3",
87
+ "eslint": "^8.8.0",
88
+ "eslint-config-airbnb-base": "^15.0.0",
89
+ "eslint-config-prettier": "^8.3.0",
90
+ "eslint-friendly-formatter": "^4.0.1",
91
+ "eslint-import-resolver-webpack": "^0.13.2",
92
+ "eslint-webpack-plugin": "^3.1.1",
93
+ "eslint-plugin-html": "^6.2.0",
94
+ "eslint-plugin-import": "^2.25.4",
95
+ "eslint-plugin-prettier": "^4.0.0",
96
+ "eslint-plugin-react": "^7.28.0",
97
+ "eslint-plugin-vue": "^8.4.0",
98
+ "eventsource-polyfill": "^0.9.6",
99
+ "express": "^4.17.2",
100
+ "figlet": "^1.5.2",
101
+ "git-clone": "^0.2.0",
102
+ "glob": "^7.2.0",
103
+ "html-loader": "^3.1.0",
104
+ "html-webpack-plugin": "^5.5.0",
105
+ "http-proxy-middleware": "^2.0.2",
106
+ "inquirer": "^8.2.0",
107
+ "mini-css-extract-plugin": "^2.5.3",
108
+ "monaco-editor-webpack-plugin": "6.0.0",
109
+ "sass": "^1.49.7",
110
+ "open": "^8.4.0",
111
+ "ora": "^4.0.4",
78
112
  "params-replace-loader": "^1.1.6",
113
+ "portfinder": "^1.0.28",
114
+ "postcss-loader": "^6.2.1",
115
+ "postcss-nested": "^5.0.6",
116
+ "postcss-preset-env": "^7.3.1",
117
+ "postcss-simple-vars": "^6.0.3",
79
118
  "progress-bar-webpack-plugin": "^2.1.0",
80
- "sass-loader": "^8.0.2",
81
- "sass-resources-loader": "^2.0.3",
82
- "string-replace-loader": "^2.3.0",
83
- "style-loader": "^1.2.1",
84
- "eventsource-polyfill": "^0.9.6",
85
- "friendly-errors-webpack-plugin": "^1.7.0",
86
- "babel-loader": "^8.1.0",
87
- "@babel/cli": "^7.10.1",
88
- "@babel/core": "^7.10.2",
89
- "@babel/polyfill": "^7.10.1",
90
- "@babel/plugin-proposal-class-properties": "^7.10.1",
91
- "@babel/plugin-proposal-decorators": "^7.10.1",
92
- "@babel/plugin-proposal-export-namespace-from": "^7.10.1",
93
- "@babel/plugin-proposal-function-sent": "^7.10.1",
94
- "@babel/plugin-proposal-json-strings": "^7.10.1",
95
- "@babel/plugin-proposal-numeric-separator": "^7.10.1",
96
- "@babel/plugin-proposal-throw-expressions": "^7.10.1",
97
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
98
- "@babel/plugin-syntax-import-meta": "^7.10.1",
99
- "@babel/plugin-transform-runtime": "^7.10.1",
100
- "@babel/preset-env": "^7.10.2",
101
- "@babel/preset-react": "^7.10.1",
102
- "@babel/register": "^7.10.1",
103
- "babel-eslint": "^10.1.0",
104
- "babel-plugin-import": "^1.13.0",
105
- "eslint-loader": "^4.0.2",
106
- "eslint": "^7.2.0",
107
- "eslint-config-airbnb-base": "^14.1.0",
108
- "eslint-friendly-formatter": "^4.0.1",
109
- "eslint-import-resolver-webpack": "^0.12.1",
110
- "eslint-plugin-html": "^6.0.2",
111
- "eslint-plugin-import": "^2.21.1",
112
- "eslint-plugin-prettier": "^3.1.3",
113
- "eslint-plugin-react": "^7.20.0",
114
- "eslint-plugin-vue": "^6.2.2",
115
- "vue-eslint-parser": "^7.1.0",
116
- "stylelint": "^13.6.0",
117
- "stylelint-config-standard": "^20.0.0",
118
- "stylelint-webpack-plugin": "^2.0.0",
119
- "@mapbox/stylelint-processor-arbitrary-tags": "^0.3.0"
119
+ "qs": "^6.10.3",
120
+ "rimraf": "^3.0.2",
121
+ "rollup": "^2.67.0",
122
+ "rollup-plugin-postcss": "^4.0.2",
123
+ "rollup-plugin-terser": "^7.0.2",
124
+ "rollup-plugin-vue": "^6.0.0",
125
+ "sass-loader": "^12.4.0",
126
+ "sass-resources-loader": "^2.2.4",
127
+ "semver": "^7.3.5",
128
+ "shelljs": "^0.8.5",
129
+ "string-replace-loader": "^3.1.0",
130
+ "style-loader": "^3.3.1",
131
+ "stylelint": "^14.3.0",
132
+ "stylelint-config-standard": "^24.0.0",
133
+ "stylelint-webpack-plugin": "^3.1.1",
134
+ "ts-import-plugin": "^2.0.0",
135
+ "ts-loader": "^9.2.6",
136
+ "typescript": "^4.5.5",
137
+ "vue-eslint-parser": "^8.2.0",
138
+ "vue-loader": "^15.9.8",
139
+ "vue-style-loader": "^4.1.3",
140
+ "vue-template-compiler": "^2.6.14",
141
+ "webpack": "^5.68.0",
142
+ "webpack-bundle-analyzer": "^4.5.0",
143
+ "webpack-cli": "^4.9.2",
144
+ "webpack-dev-middleware": "^5.3.1",
145
+ "webpack-hot-middleware": "^2.25.1",
146
+ "webpack-merge": "^5.8.0",
147
+ "webpack-node-externals": "^3.0.0",
148
+ "yargs": "^17.3.1"
120
149
  },
121
150
  "devDependencies": {
122
- "husky": "^4.2.5",
123
- "lint-staged": "^10.2.9",
124
- "prettier": "^2.0.5",
125
- "@commitlint/cli": "^8.3.5",
126
- "@commitlint/config-conventional": "^9.1.1"
151
+ "@commitlint/cli": "^16.1.0",
152
+ "@commitlint/config-conventional": "^16.0.0",
153
+ "husky": "^4.3.8",
154
+ "lint-staged": "^12.3.3",
155
+ "prettier": "^2.5.1"
127
156
  },
128
157
  "engines": {
129
158
  "node": ">= 10.13.0",
@@ -3,10 +3,11 @@ const { curWebpackBaseConfPath } = require('akfun');
3
3
 
4
4
  module.exports = {
5
5
  root: true,
6
- parser: 'babel-eslint', // 指定eslint解析器的,解析器必须符合规则
6
+ parser: '@babel/eslint-parser', // 指定eslint解析器的,解析器必须符合规则
7
7
  // 此项是用来指定javaScript语言类型和风格,sourceType用来指定js导入的方式,默认是script,此处设置为module,指某块导入方式
8
8
  parserOptions: {
9
- ecmaVersion: 6,
9
+ ecmaVersion: 8,
10
+ requireConfigFile: false,
10
11
  sourceType: 'module', // 支持的ES语法版本,默认为5。注意只是语法,不包括ES的全局变量
11
12
  ecmaFeatures: {
12
13
  // Features是特征的意思,这里用于指定要使用其他那些语言对象
@@ -23,11 +24,11 @@ module.exports = {
23
24
  // 此项是用来配置标准的js风格,就是说写代码的时候要规范的写,如果你使用vs-code我觉得应该可以避免出错
24
25
  extends: [
25
26
  'airbnb-base', // eslint-config-airbnb-base
26
- '@vue/typescript' // @vue/eslint-config-typescript: https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
27
+ 'prettier' // eslint-config-prettier
27
28
  ],
28
29
  // 此项是用来提供插件的,插件名称省略了eslint-plugin-,下面这个配置是用来规范html的
29
30
  // required to lint *.src files
30
- plugins: ['@typescript-eslint', 'prettier', 'html', 'react', 'vue'],
31
+ plugins: ['prettier', 'html', 'react'],
31
32
  // check if imports actually resolve
32
33
  settings: {
33
34
  'import/resolver': {
@@ -52,8 +53,8 @@ module.exports = {
52
53
  vue: 'never'
53
54
  }
54
55
  ],
55
- 'react/jsx-uses-react': 'error',
56
- 'react/jsx-uses-vars': 'error',
56
+ 'react/jsx-uses-react': 'error', // 防止在JSX中使用的变量被错误地标记为未使用
57
+ 'react/jsx-uses-vars': 'error', // 防止在JSX中使用的变量被错误地标记为未使用
57
58
  'import/first': 0,
58
59
  'arrow-parens': 0,
59
60
  'no-underscore-dangle': 'off',
@@ -80,6 +81,7 @@ module.exports = {
80
81
  'no-lonely-if': 0, // 禁止else语句内只有if语句
81
82
  'no-eval': 1, // JavaScript的eval()功能具有潜在的危险,并且经常被滥用
82
83
  'object-curly-newline': 0, // 该规则在对象文字括号或销毁分配中强制使用一致的换行符
83
- 'operator-linebreak': [0, 'before'] // 换行时运算符在行尾还是行首
84
+ 'operator-linebreak': [0, 'before'], // 换行时运算符在行尾还是行首
85
+ 'max-len': ['warn', { code: 150 }]
84
86
  }
85
87
  };
@@ -12,7 +12,7 @@ module.exports = {
12
12
  settings: {
13
13
  enableESLint: false, // 调试模式是否开启ESLint,默认关闭ESLint检测代码格式
14
14
  enableESLintFix: false, // 是否自动修正代码格式,默认不自动修正
15
- enableStyleLint: true, // 是否开启StyleLint,默认开启ESLint检测代码格式
15
+ enableStyleLint: false, // 是否开启StyleLint,默认开启ESLint检测代码格式
16
16
  enableStyleLintFix: false // 是否需要StyleLint自动修正代码格式
17
17
  },
18
18
  webpack: {
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {},
37
37
  "devDependencies": {
38
- "akfun": "^1.0.1",
38
+ "akfun": "^3.0.1",
39
39
  "@commitlint/cli": "^8.3.5",
40
40
  "@commitlint/config-conventional": "^9.1.1",
41
41
  "husky": "^4.2.5",
@@ -24,7 +24,7 @@ module.exports = function (entryConfig, curDefaultHtmlTemplate) {
24
24
  filename: `${filename}.html`,
25
25
  template: curPageTemplate,
26
26
  chunks: ['vendor', 'common', filename],
27
- inject: true, // 当传递true或body时,所有javascript资源都将放置在body元素的底部。
27
+ inject: 'body', // 当传递true或body时,所有javascript资源都将放置在body元素的底部。
28
28
  minify: false, // mode: 'production'模式下会自定压缩html代码,优先级比minify高
29
29
  // necessary to consistently work with multiple chunks via CommonsChunkPlugin
30
30
  chunksSortMode: 'auto'
@@ -36,7 +36,20 @@ exports.cssLoaders = function (options) {
36
36
  const cssLoader = {
37
37
  loader: 'css-loader',
38
38
  options: {
39
- url: false, // enables/disables url()/image-set() functions handling
39
+ // url: false, // enables/disables url()/image-set() functions handling
40
+ url: {
41
+ filter: (url, resourcePath) => {
42
+ /*// 自定义配置优先
43
+ if (options.cssLoaderUrl !== undefined) {
44
+ return options.cssLoaderUrl;
45
+ }*/
46
+ // Don't handle `node_modules` urls
47
+ if (resourcePath.includes('node_modules')) {
48
+ return true;
49
+ }
50
+ return false;
51
+ }
52
+ },
40
53
  sourceMap: options.sourceMap
41
54
  }
42
55
  };
@@ -121,28 +121,43 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
121
121
  url-loader 功能类似于 file-loader,在文件大小(单位 byte)低于指定的限制时,可以返回一个 DataURL。
122
122
  */
123
123
  test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
124
- loader: 'url-loader',
125
- options: {
126
- limit: 10000,
127
- name: utils.assetsPath('img/[name].[hash:7].[ext]')
124
+ type: 'asset',
125
+ parser: {
126
+ dataUrlCondition: {
127
+ maxSize: 2 * 1024 //data转成url的条件,也就是转成bas64的条件,maxSize相当于limit
128
+ }
129
+ },
130
+ generator: {
131
+ // filename,和output中设置assetModuleFilename一样,将资源打包至img文件夹
132
+ filename: utils.assetsPath('img/[name].[hash:7][ext]') //[name]指原来的名字,[hash:6]取哈希的前六位,[ext]指原来的扩展名
128
133
  }
129
134
  },
130
135
  {
131
136
  // 视频音频资源
132
137
  test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
133
- loader: 'url-loader',
134
- options: {
135
- limit: 10000,
136
- name: utils.assetsPath('media/[name].[hash:7].[ext]')
138
+ type: 'asset',
139
+ parser: {
140
+ dataUrlCondition: {
141
+ maxSize: 2 * 1024 //data转成url的条件,也就是转成bas64的条件,maxSize相当于limit
142
+ }
143
+ },
144
+ generator: {
145
+ // filename,和output中设置assetModuleFilename一样,将资源打包至imgs文件夹
146
+ filename: utils.assetsPath('media/[name].[hash:7][ext]') //[name]指原来的名字,[hash:6]取哈希的前六位,[ext]指原来的扩展名
137
147
  }
138
148
  },
139
149
  {
140
150
  // 字体资源
141
151
  test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
142
- loader: 'url-loader',
143
- options: {
144
- limit: 10000,
145
- name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
152
+ type: 'asset',
153
+ parser: {
154
+ dataUrlCondition: {
155
+ maxSize: 2 * 1024 //data转成url的条件,也就是转成bas64的条件,maxSize相当于limit
156
+ }
157
+ },
158
+ generator: {
159
+ // filename,和output中设置assetModuleFilename一样,将资源打包至fonts目录中
160
+ filename: utils.assetsPath('fonts/[name].[hash:7][ext]') //[name]指原来的名字,[hash:6]取哈希的前六位,[ext]指原来的扩展名
146
161
  }
147
162
  },
148
163
  {
@@ -7,7 +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 OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
10
+ // const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
11
11
 
12
12
  module.exports = (akfunConfig) => {
13
13
  let config = akfunConfig || projectConfig; // 默认使用执行命令目录下的配置数据
@@ -1,6 +1,6 @@
1
1
  const { merge } = require('webpack-merge');
2
- // const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
3
2
  const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // 替换extract-text-webpack-plugin
3
+ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
4
4
  const CompressionWebpackPlugin = require('compression-webpack-plugin');
5
5
  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
6
6
 
@@ -42,7 +42,12 @@ module.exports = (akfunConfig) => {
42
42
  */
43
43
  chunkIds: 'named',
44
44
  emitOnErrors: true,
45
- minimize: true
45
+ minimize: true,
46
+ minimizer: [
47
+ // For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
48
+ `...`,
49
+ new CssMinimizerPlugin()
50
+ ]
46
51
  },
47
52
  plugins: [
48
53
  new MiniCssExtractPlugin({
@@ -3,8 +3,8 @@ const path = require('path');
3
3
  const { merge } = require('webpack-merge');
4
4
  const CopyWebpackPlugin = require('copy-webpack-plugin');
5
5
  // const ExtractTextPlugin = require('extract-text-webpack-plugin'); // 不支持webpack4.0
6
- // const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
7
6
  const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // 替换extract-text-webpack-plugin
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
10
  const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
@@ -71,7 +71,12 @@ module.exports = (akfunConfig) => {
71
71
  }
72
72
  }
73
73
  },
74
- minimize: true
74
+ minimize: true,
75
+ minimizer: [
76
+ // For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
77
+ `...`,
78
+ new CssMinimizerPlugin()
79
+ ]
75
80
  },
76
81
  plugins: [
77
82
  new MiniCssExtractPlugin({