akfun 3.2.20 → 3.3.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 +2 -2
- package/src/dev-server.js +5 -4
- package/src/webpack/loaderUtils.js +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akfun",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "前端脚手架:支持Vue技术栈和react技术栈",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"前端工程",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"babel-plugin-import": "^1.13.3",
|
|
86
86
|
"chalk": "^4.0.0",
|
|
87
87
|
"compression-webpack-plugin": "^9.2.0",
|
|
88
|
-
"connect-history-api-fallback": "^
|
|
88
|
+
"connect-history-api-fallback": "^2.0.0",
|
|
89
89
|
"copy-webpack-plugin": "^10.2.4",
|
|
90
90
|
"css-loader": "^6.6.0",
|
|
91
91
|
"css-minimizer-webpack-plugin": "^3.4.1",
|
package/src/dev-server.js
CHANGED
|
@@ -50,6 +50,11 @@ module.exports = function (akfunConfig, _consoleTag) {
|
|
|
50
50
|
// 获取开发环境的webpack基本配置
|
|
51
51
|
const webpackConfig = getDevWebpackConfig(config);
|
|
52
52
|
|
|
53
|
+
// 使用 connect-history-api-fallback 匹配资源,如果不匹配就可以重定向到指定地址
|
|
54
|
+
// handle fallback for HTML5 history API
|
|
55
|
+
// 备注:需放express.static前面,避免失效
|
|
56
|
+
app.use(require('connect-history-api-fallback')());
|
|
57
|
+
|
|
53
58
|
// serve pure public assets
|
|
54
59
|
// 拼接 public 文件夹的静态资源路径
|
|
55
60
|
const staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory);
|
|
@@ -92,10 +97,6 @@ module.exports = function (akfunConfig, _consoleTag) {
|
|
|
92
97
|
});
|
|
93
98
|
}
|
|
94
99
|
|
|
95
|
-
// 使用 connect-history-api-fallback 匹配资源,如果不匹配就可以重定向到指定地址
|
|
96
|
-
// handle fallback for HTML5 history API
|
|
97
|
-
app.use(require('connect-history-api-fallback')());
|
|
98
|
-
|
|
99
100
|
const afterCreateServerAction = (isHttps, port) => {
|
|
100
101
|
spinner.succeed(`${consoleTag}调试模式已开启!`);
|
|
101
102
|
|
|
@@ -39,14 +39,15 @@ exports.cssLoaders = function (options) {
|
|
|
39
39
|
// url: false, // enables/disables url()/image-set() functions handling
|
|
40
40
|
url: {
|
|
41
41
|
filter: (url, resourcePath) => {
|
|
42
|
+
if (options.cssLoaderUrlDir && resourcePath.includes(options.cssLoaderUrlDir)) {
|
|
43
|
+
// 指定处理某类路径下的中相关 css 文件中的 url
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
42
46
|
if (url.startsWith('data:')) {
|
|
43
47
|
// 不处理 css 中的 bas64 url
|
|
44
48
|
return false;
|
|
45
|
-
} else if (options.cssLoaderUrlDir && resourcePath.includes(options.cssLoaderUrlDir)) {
|
|
46
|
-
// 指定处理某类路径下的中相关 css 文件中的 url
|
|
47
|
-
return true;
|
|
48
49
|
} else if (options.cssLoaderUrl !== undefined) {
|
|
49
|
-
// cssLoaderUrl 为
|
|
50
|
+
// cssLoaderUrl 为false 则不处理 css 中的 url
|
|
50
51
|
return options.cssLoaderUrl;
|
|
51
52
|
}
|
|
52
53
|
return true;
|