From 515eaa81e849dd716d93383cd23704727b2f4e56 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 14 Nov 2019 11:27:06 +0800 Subject: [PATCH 01/98] =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81dll=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 13 +++--- public/{index.ejs => index.html} | 1 - src/container/features/index.js | 9 ++-- src/container/routers/index.js | 6 +-- src/container/test/index.js | 6 +-- src/container/testclass/index.js | 77 +++++++++++++++++++++++--------- webpack.dev.config.js | 14 +----- webpack.dll.config.js | 23 ---------- webpack.production.config.js | 6 +-- 9 files changed, 73 insertions(+), 82 deletions(-) rename public/{index.ejs => index.html} (96%) delete mode 100644 webpack.dll.config.js diff --git a/package.json b/package.json index 8e90aebb..01b1248d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "react脚手架,最新技术", "main": "index.js", "scripts": { - "dll": "webpack -p --config webpack.dll.config.js --progress --profile --colors", "start": "node server.js --max_old_space_size=4096", "build": "webpack -p --config webpack.production.config.js", "dist": "set NODE_ENV=production&& node server.js", @@ -13,7 +12,7 @@ "cover": "./node_modules/.bin/istanbul cover _mocha", "coveralls": "npm run cover -- --report lcovonly && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls" }, - "author": "luo", + "author": "L", "license": "ISC", "private": true, "repository": { @@ -25,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^1.2.0", - "antd": "^3.25.0", + "antd": "^3.25.1", "axios": "^0.19.0", - "core-js": "^3.3.6", + "core-js": "^3.4.1", "history": "^4.10.1", "lodash": "^4.17.15", "moment": "^2.24.0", @@ -39,7 +38,7 @@ "redux": "^4.0.4" }, "devDependencies": { - "@babel/core": "^7.7.0", + "@babel/core": "^7.7.2", "@babel/plugin-proposal-class-properties": "^7.7.0", "@babel/plugin-proposal-decorators": "^7.7.0", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4", @@ -49,7 +48,7 @@ "@babel/plugin-transform-runtime": "^7.6.2", "@babel/preset-env": "^7.7.1", "@babel/preset-react": "^7.7.0", - "@babel/runtime": "^7.7.1", + "@babel/runtime": "^7.7.2", "autoprefixer": "^9.7.1", "babel-eslint": "^10.0.3", "babel-loader": "^8.0.6", @@ -73,7 +72,7 @@ "mockjs": "^1.1.0", "optimize-css-assets-webpack-plugin": "^5.0.3", "postcss-loader": "^3.0.0", - "prettier": "1.18.2", + "prettier": "1.19.1", "style-loader": "^1.0.0", "sw-precache-webpack-plugin": "^0.11.5", "terser-webpack-plugin": "^2.2.1", diff --git a/public/index.ejs b/public/index.html similarity index 96% rename from public/index.ejs rename to public/index.html index 72382db5..99054e47 100644 --- a/public/index.ejs +++ b/public/index.html @@ -5,7 +5,6 @@ React - <%= dll %>
diff --git a/src/container/features/index.js b/src/container/features/index.js index dea53e14..b3303a50 100644 --- a/src/container/features/index.js +++ b/src/container/features/index.js @@ -16,10 +16,6 @@ function FeaturesPageContainer(props) {

安装依赖文件

npm install

-
-

静态资源预编译

-

npm run dll

-

启动开发环境

npm run start

@@ -33,13 +29,14 @@ function FeaturesPageContainer(props) {

运行生产环境的代码

-

npm run dist

+

npm run dist (windows系统)

+

npm run distmac (Mac/Linux系统)

运行build文件夹下生成好的最终代码

代码自动格式化

npm run prettier

-
自动美化js/css/less等文件
+
自动美化所有js/css/less等文件

HMR局部热更新

diff --git a/src/container/routers/index.js b/src/container/routers/index.js index 2b8f173a..af42916e 100644 --- a/src/container/routers/index.js +++ b/src/container/routers/index.js @@ -6,7 +6,7 @@ import { connect } from "react-redux"; import { Router, Route, Switch, Redirect } from "react-router-dom"; // antd的多语言 -import { LocaleProvider } from "antd"; +import { ConfigProvider } from "antd"; import zhCN from "antd/lib/locale-provider/zh_CN"; // import {createBrowserHistory as createHistory} from "history/"; // URL模式的history @@ -68,7 +68,7 @@ function RootRouterContainer(props) { } return ( - + <>

Antd表单

-

+

{getFieldDecorator("username", { @@ -160,7 +160,7 @@ function TestPageContainer({
-

+

location对象测试

@@ -195,7 +195,7 @@ function TestPageContainer({

异步请求测试(Mock模拟数据)


数据: diff --git a/src/container/testclass/index.js b/src/container/testclass/index.js index 520fa320..c2dbfac3 100644 --- a/src/container/testclass/index.js +++ b/src/container/testclass/index.js @@ -23,7 +23,7 @@ class TestPageContainer extends React.Component { match: P.any, // 自动注入的match对象 history: P.any, // 自动注入的history对象 actions: P.object, // 上面model中定义的actions对象,自动成为this.props.actions变量 - form: P.any, // antd的form表单高阶组件自动注入的form对象 + form: P.any // antd的form表单高阶组件自动注入的form对象 }; /** react生命周期 - 构造函数 **/ @@ -33,13 +33,18 @@ class TestPageContainer extends React.Component { visible: false, // 模态框隐藏和显示 mokeFetch: [], // 用于测试fetch请求 mokeAjax: [], // 用于测试ajax请求 - count: 0, // 数字 + count: 0 // 数字 }; } /** react生命周期 - 组件初始化完毕DOM挂载完毕后 触发1次 **/ componentDidMount() { - console.log("所有页面默认拥有的3个对象:", this.props.location, this.props.match, this.props.history); + console.log( + "所有页面默认拥有的3个对象:", + this.props.location, + this.props.match, + this.props.history + ); const set = new Set([1, 2, 3]); const map = new Map(); console.log("Set 和 Map 测试:", set, map); @@ -82,7 +87,7 @@ class TestPageContainer extends React.Component { static getDerivedStateFromProps(nextProps, nowState) { if (nextProps.count !== nowState.count) { return { - count: nextProps.count, + count: nextProps.count }; } return null; @@ -130,14 +135,14 @@ class TestPageContainer extends React.Component { // 打开模态框按钮被点击时触发 onBtnClick() { this.setState({ - visible: true, + visible: true }); } // 关闭模态框 handleCancel() { this.setState({ - visible: false, + visible: false }); } @@ -146,7 +151,7 @@ class TestPageContainer extends React.Component { this.props.actions.serverFetch().then(res => { if (res.status === 200) { this.setState({ - mokeFetch: res.data, + mokeFetch: res.data }); } else { message.error("获取数据失败"); @@ -168,11 +173,17 @@ class TestPageContainer extends React.Component { 上方图片,一张是img,一张是background
- 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", + + 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", +
- 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 + + 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 +
- 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" + + 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" +

@@ -223,7 +234,10 @@ class TestPageContainer extends React.Component {

action测试

-
@@ -235,7 +249,7 @@ class TestPageContainer extends React.Component {

异步请求测试(Mock模拟数据)


数据: @@ -253,15 +267,36 @@ class TestPageContainer extends React.Component { 子页2 子页3 - - - - + + + +
- this.handleCancel()} onCancel={() => this.handleCancel()}> + this.handleCancel()} + onCancel={() => this.handleCancel()} + >

内容...

@@ -273,13 +308,13 @@ const FormComponent = Form.create()(TestPageContainer); export default connect( state => ({ userinfo: state.app.userinfo, // 引入app model中的userinfo数据 - count: state.test.count, // 引入test model中的count数据 + count: state.test.count // 引入test model中的count数据 }), model => ({ actions: { getUserinfo: model.app.getUserinfo, // 引入app model中的获取用户信息action onTestAdd: model.test.onTestAdd, // 引入test model中的数字+1 action - serverFetch: model.test.serverFetch, // 引入test model中的fetch异步请求action - }, - }), + serverFetch: model.test.serverFetch // 引入test model中的fetch异步请求action + } + }) )(FormComponent); diff --git a/webpack.dev.config.js b/webpack.dev.config.js index 5f5b211e..d4cfef66 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -11,7 +11,6 @@ module.exports = { entry: [ "webpack-hot-middleware/client?reload=true&path=/__webpack_hmr", // webpack热更新插件,就这么写 "./src/index.js", // 项目入口 - "./dll/vendor.dll.js", ], output: { path: __dirname + "/", // 将打包好的文件放在此路径下,dev模式中,只会在内存中存在,不会真正的打包到此路径 @@ -98,14 +97,6 @@ module.exports = { PUBLIC_URL: PUBLIC_PATH, }), }), - new webpack.DllReferencePlugin({ - context: __dirname, - /** - 下面这个地址对应webpack.dll.config.js中生成的那个json文件的路径 - 这样webpack打包时,就先直接去这个json文件中把那些预编译的资源弄进来 - **/ - manifest: require("./dll/vendor-manifest.json"), - }), new HappyPack({ loaders: ["babel-loader"], }), @@ -113,11 +104,8 @@ module.exports = { // 根据模板插入css/js等生成最终HTML filename: "index.html", //生成的html存放路径,相对于 output.path favicon: "./public/favicon.png", // 自动把根目录下的favicon.ico图片加入html - template: "./public/index.ejs", //html模板路径 + template: "./public/index.html", //html模板路径 inject: true, // 是否将js放在body的末尾 - templateParameters: { - dll: "", - }, }), ], resolve: { diff --git a/webpack.dll.config.js b/webpack.dll.config.js deleted file mode 100644 index f792a219..00000000 --- a/webpack.dll.config.js +++ /dev/null @@ -1,23 +0,0 @@ -const path = require('path'); -const webpack = require('webpack'); -const { dependencies } = require('./package.json'); -module.exports = { - mode: 'development', - entry: { - vendor: Object.keys(dependencies), - }, - output: { - path: path.join(__dirname, 'dll'), // 生成的dll.js路径,我是存在/build/dev中 - filename: '[name].dll.js', // 生成的文件名字 - library: '[name]_library', // 生成文件的一些映射关系,与下面DllPlugin中配置对应 - }, - plugins: [ - // 使用DllPlugin插件编译上面配置的NPM包 - new webpack.DllPlugin({ - // 会生成一个json文件,里面是关于dll.js的一些配置信息 - path: path.join(__dirname, 'dll', '[name]-manifest.json'), - name: '[name]_library', // 与上面output中配置对应 - context: __dirname, - }), - ], -}; diff --git a/webpack.production.config.js b/webpack.production.config.js index c12d4a7a..e4449381 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -155,11 +155,7 @@ module.exports = { * **/ new HtmlWebpackPlugin({ filename: "index.html", // 生成的html存放路径,相对于 output.path - template: "./public/index.ejs", // html模板路径 - templateParameters: { - // 自动替换index.ejs中的参数 - dll: "", - }, + template: "./public/index.html", // html模板路径 hash: false, // 防止缓存,在引入的文件后面加hash (PWA就是要缓存,这里设置为false) inject: true, // 是否将js放在body的末尾 }), From e771be483f2420b5c617e590fd5b0c7b7d723b46 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 14 Nov 2019 11:33:14 +0800 Subject: [PATCH 02/98] update --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index 2216bba0..70759376 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,6 @@ react automaticaly
yarn install # 安装依赖模块 ``` -``` -yarn dll # 静态资源预编译 -``` - ``` yarn start # 运行开发环境,默认监听8888端口 ``` @@ -59,7 +55,6 @@ yarn distmac # MAC下运行最终文件 │   ├── index.html # 编译后的主页html │   ├── manifest.json # PWA配置文件,配置了桌面图标,以APP方式启动时的启动页面相关参数 │   └── service-worker.js # PWA核心worker, 用于离线访问,缓存不变的资源文件 -├── dll # 静态资源预编译插件生成的dll文件 ├── mock # mock测试数据 ├── public # 静态文件,index.html等 ├── src                                 # 项目代码目录 From 73e4c2821fae7b6b78aba4038d91fcc54e5af961 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 14 Nov 2019 11:33:50 +0800 Subject: [PATCH 03/98] update --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c4e153a9..72bfaf33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: node_js node_js: - - '10' - - '8' + - "10" + - "8" script: - - yarn dll - yarn build From 24ac80fb21eab56876a2f249bdbc5c2601c61d77 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 14 Nov 2019 11:39:45 +0800 Subject: [PATCH 04/98] update --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 70759376..dc4c2b0d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ react automaticaly
标准的 React+Redux 分层结构
经过了多个项目的实践,不停的更新和优化出来的。目前自己做项目也在用。 -- PWA、Hooks、代码分割、热替换、dllPlugin 静态资源预编译、HappyPack 多线程构建、ES6+语法 +- PWA、Hooks、代码分割、热替换、HappyPack 多线程构建、ES6+语法 ## 注意的地方 @@ -73,7 +73,6 @@ yarn distmac # MAC下运行最终文件 │   └── index.html                     # 主页html文件,开发环境和生产打包共用 ├── server.js # 用于开发环境的服务部署 ├── webpack.dev.config.js # 用于开发环境的webpack配置 -├── webpack.dll.config.js # 静态资源预编译所需webpack配置 └── webpack.production.config.js # 用于生产环境正式打包的webpack配置 ``` From 26e6df28eedd059e1d930f5e9d1df6e103e7f485 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 19 Nov 2019 18:14:02 +0800 Subject: [PATCH 05/98] update --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 01b1248d..6643ad24 100644 --- a/package.json +++ b/package.json @@ -24,14 +24,14 @@ }, "dependencies": { "@rematch/core": "^1.2.0", - "antd": "^3.25.1", + "antd": "^3.25.2", "axios": "^0.19.0", "core-js": "^3.4.1", "history": "^4.10.1", "lodash": "^4.17.15", "moment": "^2.24.0", - "react": "^16.11.0", - "react-dom": "^16.11.0", + "react": "^16.12.0", + "react-dom": "^16.12.0", "react-loadable": "^5.5.0", "react-redux": "^7.1.3", "react-router-dom": "^5.1.2", @@ -49,7 +49,7 @@ "@babel/preset-env": "^7.7.1", "@babel/preset-react": "^7.7.0", "@babel/runtime": "^7.7.2", - "autoprefixer": "^9.7.1", + "autoprefixer": "^9.7.2", "babel-eslint": "^10.0.3", "babel-loader": "^8.0.6", "babel-plugin-import": "^1.12.2", @@ -60,7 +60,7 @@ "eslint-loader": "^3.0.2", "eslint-plugin-prettier": "^3.1.1", "eslint-plugin-react": "^7.16.0", - "eslint-plugin-react-hooks": "^2.2.0", + "eslint-plugin-react-hooks": "^2.3.0", "express": "^4.17.1", "favicons-webpack-plugin": "^1.0.2", "file-loader": "^4.2.0", From 2b996fc47ca4f18e64154c1ac72ad4072600c63c Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Mon, 25 Nov 2019 14:57:50 +0800 Subject: [PATCH 06/98] update package --- package.json | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 6643ad24..6cf7c8e3 100644 --- a/package.json +++ b/package.json @@ -23,10 +23,10 @@ "pnp": false }, "dependencies": { - "@rematch/core": "^1.2.0", - "antd": "^3.25.2", + "@rematch/core": "^1.3.0", + "antd": "^3.25.3", "axios": "^0.19.0", - "core-js": "^3.4.1", + "core-js": "^3.4.2", "history": "^4.10.1", "lodash": "^4.17.15", "moment": "^2.24.0", @@ -38,17 +38,17 @@ "redux": "^4.0.4" }, "devDependencies": { - "@babel/core": "^7.7.2", - "@babel/plugin-proposal-class-properties": "^7.7.0", - "@babel/plugin-proposal-decorators": "^7.7.0", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4", - "@babel/plugin-proposal-object-rest-spread": "^7.6.2", - "@babel/plugin-proposal-optional-chaining": "^7.6.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/plugin-transform-runtime": "^7.6.2", - "@babel/preset-env": "^7.7.1", - "@babel/preset-react": "^7.7.0", - "@babel/runtime": "^7.7.2", + "@babel/core": "^7.7.4", + "@babel/plugin-proposal-class-properties": "^7.7.4", + "@babel/plugin-proposal-decorators": "^7.7.4", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4", + "@babel/plugin-proposal-object-rest-spread": "^7.7.4", + "@babel/plugin-proposal-optional-chaining": "^7.7.4", + "@babel/plugin-syntax-dynamic-import": "^7.7.4", + "@babel/plugin-transform-runtime": "^7.7.4", + "@babel/preset-env": "^7.7.4", + "@babel/preset-react": "^7.7.4", + "@babel/runtime": "^7.7.4", "autoprefixer": "^9.7.2", "babel-eslint": "^10.0.3", "babel-loader": "^8.0.6", @@ -56,14 +56,14 @@ "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "css-loader": "^3.2.0", - "eslint": "^6.6.0", + "eslint": "^6.7.1", "eslint-loader": "^3.0.2", "eslint-plugin-prettier": "^3.1.1", "eslint-plugin-react": "^7.16.0", "eslint-plugin-react-hooks": "^2.3.0", "express": "^4.17.1", "favicons-webpack-plugin": "^1.0.2", - "file-loader": "^4.2.0", + "file-loader": "^4.3.0", "happypack": "^5.0.1", "html-webpack-plugin": "^3.2.0", "less": "^3.10.3", @@ -76,7 +76,7 @@ "style-loader": "^1.0.0", "sw-precache-webpack-plugin": "^0.11.5", "terser-webpack-plugin": "^2.2.1", - "url-loader": "^2.2.0", + "url-loader": "^2.3.0", "webpack": "^4.41.2", "webpack-cli": "^3.3.10", "webpack-dev-middleware": "^3.7.2", From 82a358eae4fc4b603304e11a1ac34ba1a765c637 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 28 Nov 2019 13:43:34 +0800 Subject: [PATCH 07/98] update pachage --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 6cf7c8e3..6ecf843b 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@rematch/core": "^1.3.0", "antd": "^3.25.3", "axios": "^0.19.0", - "core-js": "^3.4.2", + "core-js": "^3.4.5", "history": "^4.10.1", "lodash": "^4.17.15", "moment": "^2.24.0", @@ -52,7 +52,7 @@ "autoprefixer": "^9.7.2", "babel-eslint": "^10.0.3", "babel-loader": "^8.0.6", - "babel-plugin-import": "^1.12.2", + "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "css-loader": "^3.2.0", @@ -63,7 +63,7 @@ "eslint-plugin-react-hooks": "^2.3.0", "express": "^4.17.1", "favicons-webpack-plugin": "^1.0.2", - "file-loader": "^4.3.0", + "file-loader": "^5.0.2", "happypack": "^5.0.1", "html-webpack-plugin": "^3.2.0", "less": "^3.10.3", @@ -76,7 +76,7 @@ "style-loader": "^1.0.0", "sw-precache-webpack-plugin": "^0.11.5", "terser-webpack-plugin": "^2.2.1", - "url-loader": "^2.3.0", + "url-loader": "^3.0.0", "webpack": "^4.41.2", "webpack-cli": "^3.3.10", "webpack-dev-middleware": "^3.7.2", From 1275aaaa9aeefca10247f82e9e6b17b6fd442034 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 17 Dec 2019 13:56:03 +0800 Subject: [PATCH 08/98] update --- package.json | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 6ecf843b..99615975 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^1.3.0", - "antd": "^3.25.3", + "antd": "^3.26.3", "axios": "^0.19.0", - "core-js": "^3.4.5", + "core-js": "^3.5.0", "history": "^4.10.1", "lodash": "^4.17.15", "moment": "^2.24.0", @@ -38,28 +38,28 @@ "redux": "^4.0.4" }, "devDependencies": { - "@babel/core": "^7.7.4", + "@babel/core": "^7.7.5", "@babel/plugin-proposal-class-properties": "^7.7.4", "@babel/plugin-proposal-decorators": "^7.7.4", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4", "@babel/plugin-proposal-object-rest-spread": "^7.7.4", - "@babel/plugin-proposal-optional-chaining": "^7.7.4", + "@babel/plugin-proposal-optional-chaining": "^7.7.5", "@babel/plugin-syntax-dynamic-import": "^7.7.4", - "@babel/plugin-transform-runtime": "^7.7.4", - "@babel/preset-env": "^7.7.4", + "@babel/plugin-transform-runtime": "^7.7.6", + "@babel/preset-env": "^7.7.6", "@babel/preset-react": "^7.7.4", - "@babel/runtime": "^7.7.4", - "autoprefixer": "^9.7.2", + "@babel/runtime": "^7.7.6", + "autoprefixer": "^9.7.3", "babel-eslint": "^10.0.3", "babel-loader": "^8.0.6", "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "css-loader": "^3.2.0", - "eslint": "^6.7.1", - "eslint-loader": "^3.0.2", - "eslint-plugin-prettier": "^3.1.1", - "eslint-plugin-react": "^7.16.0", + "css-loader": "^3.3.2", + "eslint": "^6.7.2", + "eslint-loader": "^3.0.3", + "eslint-plugin-prettier": "^3.1.2", + "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^2.3.0", "express": "^4.17.1", "favicons-webpack-plugin": "^1.0.2", @@ -73,11 +73,11 @@ "optimize-css-assets-webpack-plugin": "^5.0.3", "postcss-loader": "^3.0.0", "prettier": "1.19.1", - "style-loader": "^1.0.0", + "style-loader": "^1.0.1", "sw-precache-webpack-plugin": "^0.11.5", - "terser-webpack-plugin": "^2.2.1", + "terser-webpack-plugin": "^2.3.0", "url-loader": "^3.0.0", - "webpack": "^4.41.2", + "webpack": "^4.41.3", "webpack-cli": "^3.3.10", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", From 2b14fae59a543f7660812baec6352e11d5c708ba Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Wed, 25 Dec 2019 16:16:09 +0800 Subject: [PATCH 09/98] update use dayjs --- package.json | 28 +++--- src/container/routers/index.js | 34 +++---- .../container/{page1/index.js => page1.js} | 0 .../container/{page2/index.js => page2.js} | 0 .../container/{page3/index.js => page3.js} | 0 src/container/test/index.js | 56 ++++-------- src/container/testclass/index.js | 89 ++++++------------- src/container/testclass/index.less | 2 +- webpack.dev.config.js | 2 + webpack.production.config.js | 4 +- 10 files changed, 75 insertions(+), 140 deletions(-) rename src/container/test/container/{page1/index.js => page1.js} (100%) rename src/container/test/container/{page2/index.js => page2.js} (100%) rename src/container/test/container/{page3/index.js => page3.js} (100%) diff --git a/package.json b/package.json index 99615975..4d31f266 100644 --- a/package.json +++ b/package.json @@ -24,39 +24,39 @@ }, "dependencies": { "@rematch/core": "^1.3.0", - "antd": "^3.26.3", + "antd": "3.26.4", + "antd-dayjs-webpack-plugin": "^0.0.7", "axios": "^0.19.0", - "core-js": "^3.5.0", + "core-js": "^3.6.1", "history": "^4.10.1", "lodash": "^4.17.15", - "moment": "^2.24.0", "react": "^16.12.0", "react-dom": "^16.12.0", "react-loadable": "^5.5.0", "react-redux": "^7.1.3", "react-router-dom": "^5.1.2", - "redux": "^4.0.4" + "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.7.5", + "@babel/core": "^7.7.7", "@babel/plugin-proposal-class-properties": "^7.7.4", "@babel/plugin-proposal-decorators": "^7.7.4", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4", - "@babel/plugin-proposal-object-rest-spread": "^7.7.4", + "@babel/plugin-proposal-object-rest-spread": "^7.7.7", "@babel/plugin-proposal-optional-chaining": "^7.7.5", "@babel/plugin-syntax-dynamic-import": "^7.7.4", "@babel/plugin-transform-runtime": "^7.7.6", - "@babel/preset-env": "^7.7.6", + "@babel/preset-env": "^7.7.7", "@babel/preset-react": "^7.7.4", - "@babel/runtime": "^7.7.6", + "@babel/runtime": "^7.7.7", "autoprefixer": "^9.7.3", "babel-eslint": "^10.0.3", "babel-loader": "^8.0.6", "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "css-loader": "^3.3.2", - "eslint": "^6.7.2", + "css-loader": "^3.4.0", + "eslint": "^6.8.0", "eslint-loader": "^3.0.3", "eslint-plugin-prettier": "^3.1.2", "eslint-plugin-react": "^7.17.0", @@ -68,16 +68,16 @@ "html-webpack-plugin": "^3.2.0", "less": "^3.10.3", "less-loader": "^5.0.0", - "mini-css-extract-plugin": "^0.8.0", + "mini-css-extract-plugin": "^0.9.0", "mockjs": "^1.1.0", "optimize-css-assets-webpack-plugin": "^5.0.3", "postcss-loader": "^3.0.0", "prettier": "1.19.1", - "style-loader": "^1.0.1", + "style-loader": "1.0.1", "sw-precache-webpack-plugin": "^0.11.5", - "terser-webpack-plugin": "^2.3.0", + "terser-webpack-plugin": "^2.3.1", "url-loader": "^3.0.0", - "webpack": "^4.41.3", + "webpack": "^4.41.4", "webpack-cli": "^3.3.10", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", diff --git a/src/container/routers/index.js b/src/container/routers/index.js index af42916e..3632faf6 100644 --- a/src/container/routers/index.js +++ b/src/container/routers/index.js @@ -24,23 +24,23 @@ import "./index.less"; const Home = Loadable({ loader: () => import(/* webpackChunkName:'home' */ "../home"), loading: Loading, // 自定义的Loading动画组件 - timeout: 10000 // 可以设置一个超时时间(s)来应对网络慢的情况(在Loading动画组件中可以配置error信息) + timeout: 10000, // 可以设置一个超时时间(s)来应对网络慢的情况(在Loading动画组件中可以配置error信息) }); const Test = Loadable({ loader: () => import(/* webpackChunkName:'test' */ "../test"), - loading: Loading + loading: Loading, }); const TestClass = Loadable({ loader: () => import(/* webpackChunkName:'testclass' */ "../testclass"), - loading: Loading + loading: Loading, }); const Features = Loadable({ loader: () => import(/* webpackChunkName:'features' */ "../features"), - loading: Loading + loading: Loading, }); const NotFound = Loadable({ loader: () => import(/* webpackChunkName:'notfound' */ "../notfound"), - loading: Loading + loading: Loading, }); const history = createHistory(); // 实例化history对象 @@ -77,22 +77,10 @@ function RootRouterContainer(props) {
- onEnter(Home, props)} - /> - onEnter(Features, props)} - /> - onEnter(Test, props)} - /> - onEnter(TestClass, props)} - /> + onEnter(Home, props)} /> + onEnter(Features, props)} /> + onEnter(Test, props)} /> + onEnter(TestClass, props)} /> @@ -110,6 +98,6 @@ function RootRouterContainer(props) { export default connect( state => ({}), dispatch => ({ - actions: {} - }) + actions: {}, + }), )(RootRouterContainer); diff --git a/src/container/test/container/page1/index.js b/src/container/test/container/page1.js similarity index 100% rename from src/container/test/container/page1/index.js rename to src/container/test/container/page1.js diff --git a/src/container/test/container/page2/index.js b/src/container/test/container/page2.js similarity index 100% rename from src/container/test/container/page2/index.js rename to src/container/test/container/page2.js diff --git a/src/container/test/container/page3/index.js b/src/container/test/container/page3.js similarity index 100% rename from src/container/test/container/page3/index.js rename to src/container/test/container/page3.js diff --git a/src/container/test/index.js b/src/container/test/index.js index 1bdd2fdc..59107cf9 100644 --- a/src/container/test/index.js +++ b/src/container/test/index.js @@ -6,13 +6,14 @@ import { connect } from "react-redux"; import { Route, Switch, Link } from "react-router-dom"; /** 所需的所有资源 **/ -import { Button, Modal, message, Form, Input, Icon } from "antd"; +import { Modal, Form, Button, message, Input, Icon } from "antd"; +import "./index.less"; + import ImgTest from "../../assets/test.jpg"; import Mp3 from "../../assets/starSky.mp3"; import Page1 from "./container/page1"; // 子页面1 import Page2 from "./container/page2"; // 子页面2 import Page3 from "./container/page3"; // 子页面3 -import "./index.less"; /** 组件 **/ function TestPageContainer({ @@ -21,11 +22,11 @@ function TestPageContainer({ match, // 自动注入的match对象 history, // 自动注入的history对象 actions, // 上面model中定义的actions对象,自动成为this.props.actions变量 - form // antd的form表单高阶组件自动注入的form对象 + form, // antd的form表单高阶组件自动注入的form对象 }) { const [visible, setVisible] = useState(false); // 模态框隐藏和显示 const [mokeFetch, setMokeFetch] = useState([]); // 用于测试fetch请求 - const [mokeAjax, setMokeAjax] = useState([]); // 用于测试ajax请求 + // const [mokeAjax, setMokeAjax] = useState([]); // 用于测试ajax请求 const [localCount, setLocalCount] = useState(0); // 数字 // 仅组件加载完毕时触发一次 @@ -92,17 +93,11 @@ function TestPageContainer({ 上方图片,一张是img,一张是background
- - 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", - + 请特别注意,现在webpack.production.config.js中的publicPath配置为"/",
- - 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 - + 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题
- - 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" - + 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/"

@@ -138,21 +133,13 @@ function TestPageContainer({
{getFieldDecorator("username", { - rules: [{ required: true, message: "请输入用户名" }] - })( - } placeholder="用户名" /> - )} + rules: [{ required: true, message: "请输入用户名" }], + })(} placeholder="用户名" />)} {getFieldDecorator("password", { - rules: [{ required: true, message: "请输入密码" }] - })( - } - placeholder="密码" - /> - )} + rules: [{ required: true, message: "请输入密码" }], + })(} placeholder="密码" />)}
- setVisible(false)} - onCancel={() => setVisible(false)} - > + setVisible(false)} onCancel={() => setVisible(false)}>

内容...

); } -const FormContainer = Form.create({})(TestPageContainer); +const FormComponent = Form.create()(TestPageContainer); export default connect( state => ({ userinfo: state.app.userinfo, // 引入app model中的userinfo数据 - count: state.test.count // 引入test model中的count数据 + count: state.test.count, // 引入test model中的count数据 }), dispatch => ({ actions: { getUserinfo: dispatch.app.getUserinfo, // 引入app model中的获取用户信息action onTestAdd: dispatch.test.onTestAdd, // 引入test model中的数字+1 action - serverFetch: dispatch.test.serverFetch // 引入test model中的fetch异步请求action - } - }) -)(FormContainer); + serverFetch: dispatch.test.serverFetch, // 引入test model中的fetch异步请求action + }, + }), +)(FormComponent); diff --git a/src/container/testclass/index.js b/src/container/testclass/index.js index c2dbfac3..e43cca63 100644 --- a/src/container/testclass/index.js +++ b/src/container/testclass/index.js @@ -7,8 +7,9 @@ import { Route, Switch, Link } from "react-router-dom"; import P from "prop-types"; /** 所需的所有资源 **/ -import { Button, Modal, message, Form } from "antd"; +import { Modal, Form, Button, message } from "antd"; import "./index.less"; + import ImgTest from "../../assets/test.jpg"; import Mp3 from "../../assets/starSky.mp3"; import Page1 from "./container/page1"; // 子页面1 @@ -16,14 +17,14 @@ import Page2 from "./container/page2"; // 子页面2 import Page3 from "./container/page3"; // 子页面3 /** 组件 **/ -class TestPageContainer extends React.Component { +class TestClassPageContainer extends React.Component { static propTypes = { count: P.number, // 来自store - test model中的全局变量count location: P.any, // 自动注入的location对象 match: P.any, // 自动注入的match对象 history: P.any, // 自动注入的history对象 actions: P.object, // 上面model中定义的actions对象,自动成为this.props.actions变量 - form: P.any // antd的form表单高阶组件自动注入的form对象 + form: P.any, // antd的form表单高阶组件自动注入的form对象 }; /** react生命周期 - 构造函数 **/ @@ -33,18 +34,13 @@ class TestPageContainer extends React.Component { visible: false, // 模态框隐藏和显示 mokeFetch: [], // 用于测试fetch请求 mokeAjax: [], // 用于测试ajax请求 - count: 0 // 数字 + count: 0, // 数字 }; } /** react生命周期 - 组件初始化完毕DOM挂载完毕后 触发1次 **/ componentDidMount() { - console.log( - "所有页面默认拥有的3个对象:", - this.props.location, - this.props.match, - this.props.history - ); + console.log("所有页面默认拥有的3个对象:", this.props.location, this.props.match, this.props.history); const set = new Set([1, 2, 3]); const map = new Map(); console.log("Set 和 Map 测试:", set, map); @@ -87,7 +83,7 @@ class TestPageContainer extends React.Component { static getDerivedStateFromProps(nextProps, nowState) { if (nextProps.count !== nowState.count) { return { - count: nextProps.count + count: nextProps.count, }; } return null; @@ -127,22 +123,17 @@ class TestPageContainer extends React.Component { */ componentDidCatch(error, info) {} - /** - * react生命周期 - 组件即将被卸载时触发 - * **/ - componentWillUnmount() {} - // 打开模态框按钮被点击时触发 onBtnClick() { this.setState({ - visible: true + visible: true, }); } // 关闭模态框 handleCancel() { this.setState({ - visible: false + visible: false, }); } @@ -151,7 +142,7 @@ class TestPageContainer extends React.Component { this.props.actions.serverFetch().then(res => { if (res.status === 200) { this.setState({ - mokeFetch: res.data + mokeFetch: res.data, }); } else { message.error("获取数据失败"); @@ -163,7 +154,7 @@ class TestPageContainer extends React.Component { const { form } = this.props; return ( -
+

功能测试

@@ -173,17 +164,11 @@ class TestPageContainer extends React.Component { 上方图片,一张是img,一张是background
- - 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", - + 请特别注意,现在webpack.production.config.js中的publicPath配置为"/",
- - 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 - + 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题
- - 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" - + 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/"

@@ -234,10 +219,7 @@ class TestPageContainer extends React.Component {

action测试

-
@@ -267,36 +249,15 @@ class TestPageContainer extends React.Component { 子页2 子页3 - - - - + + + +

- this.handleCancel()} - onCancel={() => this.handleCancel()} - > + this.handleCancel()} onCancel={() => this.handleCancel()}>

内容...

@@ -304,17 +265,17 @@ class TestPageContainer extends React.Component { } } -const FormComponent = Form.create()(TestPageContainer); +const FormComponent = Form.create()(TestClassPageContainer); export default connect( state => ({ userinfo: state.app.userinfo, // 引入app model中的userinfo数据 - count: state.test.count // 引入test model中的count数据 + count: state.test.count, // 引入test model中的count数据 }), model => ({ actions: { getUserinfo: model.app.getUserinfo, // 引入app model中的获取用户信息action onTestAdd: model.test.onTestAdd, // 引入test model中的数字+1 action - serverFetch: model.test.serverFetch // 引入test model中的fetch异步请求action - } - }) + serverFetch: model.test.serverFetch, // 引入test model中的fetch异步请求action + }, + }), )(FormComponent); diff --git a/src/container/testclass/index.less b/src/container/testclass/index.less index c17db627..1abb7753 100644 --- a/src/container/testclass/index.less +++ b/src/container/testclass/index.less @@ -1,4 +1,4 @@ -.page-test { +.page-test-class { width: 100%; max-width: 1200px; margin: 0 auto; diff --git a/webpack.dev.config.js b/webpack.dev.config.js index d4cfef66..f87a3517 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -3,6 +3,7 @@ const path = require("path"); // 获取绝对路径用 const webpack = require("webpack"); // webpack核心 const HtmlWebpackPlugin = require("html-webpack-plugin"); // 动态生成html插件 +const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin"); const HappyPack = require("happypack"); // 多线程编译 const webpackbar = require("webpackbar"); const PUBLIC_PATH = "/"; // 基础路径 @@ -92,6 +93,7 @@ module.exports = { plugins: [ new webpackbar(), new webpack.HotModuleReplacementPlugin(), // 热更新插件 + new AntdDayjsWebpackPlugin(), // dayjs 替代 momentjs new webpack.DefinePlugin({ "process.env": JSON.stringify({ PUBLIC_URL: PUBLIC_PATH, diff --git a/webpack.production.config.js b/webpack.production.config.js index e4449381..347d9a81 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -4,6 +4,7 @@ const path = require("path"); const webpack = require("webpack"); // webpack核心 const MiniCssExtractPlugin = require("mini-css-extract-plugin"); // 为了单独打包css const HtmlWebpackPlugin = require("html-webpack-plugin"); // 生成html +const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin"); const { CleanWebpackPlugin } = require("clean-webpack-plugin"); // 每次打包前清除旧的build文件夹 const SWPrecacheWebpackPlugin = require("sw-precache-webpack-plugin"); // 生成一个server-worker用于缓存 const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); // 自动生成各尺寸的favicon图标 @@ -28,7 +29,7 @@ module.exports = { chunkFilename: "dist/[name].[chunkhash:8].chunk.js", }, stats: { - warningsFilter: warning => /Conflicting order between/gm.test(warning), // 不输出一些警告,多为因CSS引入顺序不同导致的警告 + warningsFilter: warning => /Conflicting order/gm.test(warning), // 不输出一些警告,多为因CSS引入顺序不同导致的警告 children: false, // 不输出子模块的打包信息 }, optimization: { @@ -115,6 +116,7 @@ module.exports = { * **/ new CleanWebpackPlugin(), new webpackbar(), + new AntdDayjsWebpackPlugin(), // dayjs 替代 momentjs /** * 在window环境中注入全局变量 * 这里这么做是因为src/registerServiceWorker.js中有用到,为了配置PWA From cd7ebded3daca625ebefb006da1794f4826b20ce Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Mon, 30 Dec 2019 17:48:59 +0800 Subject: [PATCH 10/98] favicons update --- package.json | 2 +- webpack.production.config.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 4d31f266..de385956 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^2.3.0", "express": "^4.17.1", - "favicons-webpack-plugin": "^1.0.2", + "favicons-webpack-plugin": "2.0.0", "file-loader": "^5.0.2", "happypack": "^5.0.1", "html-webpack-plugin": "^3.2.0", diff --git a/webpack.production.config.js b/webpack.production.config.js index 347d9a81..046e0432 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -185,8 +185,8 @@ module.exports = { icons: { // 生成哪些平台需要的图标 android: true, // 安卓 - appleIcon: true, // 苹果 - appleStartup: true, // 苹果启动页 + appleIcon: false, // 苹果 + appleStartup: false, // 苹果启动页 coast: false, // opera favicons: true, // web小图标 firefox: false, // 火狐 From b5e4ddc56f30087ae0635e40b08c8d2994bdc974 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Sat, 18 Jan 2020 12:31:34 +0800 Subject: [PATCH 11/98] update package.json --- package.json | 42 +++++++++--------- src/container/routers/index.js | 34 ++++++++++----- src/container/test/index.js | 45 +++++++++++++------ src/container/testclass/index.js | 75 +++++++++++++++++++++++--------- 4 files changed, 131 insertions(+), 65 deletions(-) diff --git a/package.json b/package.json index de385956..36a9f9b5 100644 --- a/package.json +++ b/package.json @@ -24,10 +24,10 @@ }, "dependencies": { "@rematch/core": "^1.3.0", - "antd": "3.26.4", - "antd-dayjs-webpack-plugin": "^0.0.7", - "axios": "^0.19.0", - "core-js": "^3.6.1", + "antd": "3.26.7", + "antd-dayjs-webpack-plugin": "^0.0.8", + "axios": "^0.19.1", + "core-js": "^3.6.4", "history": "^4.10.1", "lodash": "^4.17.15", "react": "^16.12.0", @@ -38,28 +38,28 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.7.7", - "@babel/plugin-proposal-class-properties": "^7.7.4", - "@babel/plugin-proposal-decorators": "^7.7.4", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4", - "@babel/plugin-proposal-object-rest-spread": "^7.7.7", - "@babel/plugin-proposal-optional-chaining": "^7.7.5", - "@babel/plugin-syntax-dynamic-import": "^7.7.4", - "@babel/plugin-transform-runtime": "^7.7.6", - "@babel/preset-env": "^7.7.7", - "@babel/preset-react": "^7.7.4", - "@babel/runtime": "^7.7.7", - "autoprefixer": "^9.7.3", + "@babel/core": "^7.8.3", + "@babel/plugin-proposal-class-properties": "^7.8.3", + "@babel/plugin-proposal-decorators": "^7.8.3", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-proposal-object-rest-spread": "^7.8.3", + "@babel/plugin-proposal-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-transform-runtime": "^7.8.3", + "@babel/preset-env": "^7.8.3", + "@babel/preset-react": "^7.8.3", + "@babel/runtime": "^7.8.3", + "autoprefixer": "^9.7.4", "babel-eslint": "^10.0.3", "babel-loader": "^8.0.6", "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "css-loader": "^3.4.0", + "css-loader": "^3.4.2", "eslint": "^6.8.0", "eslint-loader": "^3.0.3", "eslint-plugin-prettier": "^3.1.2", - "eslint-plugin-react": "^7.17.0", + "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "express": "^4.17.1", "favicons-webpack-plugin": "2.0.0", @@ -73,11 +73,11 @@ "optimize-css-assets-webpack-plugin": "^5.0.3", "postcss-loader": "^3.0.0", "prettier": "1.19.1", - "style-loader": "1.0.1", + "style-loader": "1.1.3", "sw-precache-webpack-plugin": "^0.11.5", - "terser-webpack-plugin": "^2.3.1", + "terser-webpack-plugin": "^2.3.2", "url-loader": "^3.0.0", - "webpack": "^4.41.4", + "webpack": "^4.41.5", "webpack-cli": "^3.3.10", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", diff --git a/src/container/routers/index.js b/src/container/routers/index.js index 3632faf6..af42916e 100644 --- a/src/container/routers/index.js +++ b/src/container/routers/index.js @@ -24,23 +24,23 @@ import "./index.less"; const Home = Loadable({ loader: () => import(/* webpackChunkName:'home' */ "../home"), loading: Loading, // 自定义的Loading动画组件 - timeout: 10000, // 可以设置一个超时时间(s)来应对网络慢的情况(在Loading动画组件中可以配置error信息) + timeout: 10000 // 可以设置一个超时时间(s)来应对网络慢的情况(在Loading动画组件中可以配置error信息) }); const Test = Loadable({ loader: () => import(/* webpackChunkName:'test' */ "../test"), - loading: Loading, + loading: Loading }); const TestClass = Loadable({ loader: () => import(/* webpackChunkName:'testclass' */ "../testclass"), - loading: Loading, + loading: Loading }); const Features = Loadable({ loader: () => import(/* webpackChunkName:'features' */ "../features"), - loading: Loading, + loading: Loading }); const NotFound = Loadable({ loader: () => import(/* webpackChunkName:'notfound' */ "../notfound"), - loading: Loading, + loading: Loading }); const history = createHistory(); // 实例化history对象 @@ -77,10 +77,22 @@ function RootRouterContainer(props) {
- onEnter(Home, props)} /> - onEnter(Features, props)} /> - onEnter(Test, props)} /> - onEnter(TestClass, props)} /> + onEnter(Home, props)} + /> + onEnter(Features, props)} + /> + onEnter(Test, props)} + /> + onEnter(TestClass, props)} + /> @@ -98,6 +110,6 @@ function RootRouterContainer(props) { export default connect( state => ({}), dispatch => ({ - actions: {}, - }), + actions: {} + }) )(RootRouterContainer); diff --git a/src/container/test/index.js b/src/container/test/index.js index 59107cf9..c97f3f98 100644 --- a/src/container/test/index.js +++ b/src/container/test/index.js @@ -22,7 +22,7 @@ function TestPageContainer({ match, // 自动注入的match对象 history, // 自动注入的history对象 actions, // 上面model中定义的actions对象,自动成为this.props.actions变量 - form, // antd的form表单高阶组件自动注入的form对象 + form // antd的form表单高阶组件自动注入的form对象 }) { const [visible, setVisible] = useState(false); // 模态框隐藏和显示 const [mokeFetch, setMokeFetch] = useState([]); // 用于测试fetch请求 @@ -93,11 +93,17 @@ function TestPageContainer({ 上方图片,一张是img,一张是background
- 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", + + 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", +
- 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 + + 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 +
- 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" + + 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" +

@@ -133,13 +139,21 @@ function TestPageContainer({ {getFieldDecorator("username", { - rules: [{ required: true, message: "请输入用户名" }], - })(} placeholder="用户名" />)} + rules: [{ required: true, message: "请输入用户名" }] + })( + } placeholder="用户名" /> + )} {getFieldDecorator("password", { - rules: [{ required: true, message: "请输入密码" }], - })(} placeholder="密码" />)} + rules: [{ required: true, message: "请输入密码" }] + })( + } + placeholder="密码" + /> + )}
- setVisible(false)} onCancel={() => setVisible(false)}> + setVisible(false)} + onCancel={() => setVisible(false)} + >

内容...

@@ -220,13 +239,13 @@ const FormComponent = Form.create()(TestPageContainer); export default connect( state => ({ userinfo: state.app.userinfo, // 引入app model中的userinfo数据 - count: state.test.count, // 引入test model中的count数据 + count: state.test.count // 引入test model中的count数据 }), dispatch => ({ actions: { getUserinfo: dispatch.app.getUserinfo, // 引入app model中的获取用户信息action onTestAdd: dispatch.test.onTestAdd, // 引入test model中的数字+1 action - serverFetch: dispatch.test.serverFetch, // 引入test model中的fetch异步请求action - }, - }), + serverFetch: dispatch.test.serverFetch // 引入test model中的fetch异步请求action + } + }) )(FormComponent); diff --git a/src/container/testclass/index.js b/src/container/testclass/index.js index e43cca63..e99a3484 100644 --- a/src/container/testclass/index.js +++ b/src/container/testclass/index.js @@ -24,7 +24,7 @@ class TestClassPageContainer extends React.Component { match: P.any, // 自动注入的match对象 history: P.any, // 自动注入的history对象 actions: P.object, // 上面model中定义的actions对象,自动成为this.props.actions变量 - form: P.any, // antd的form表单高阶组件自动注入的form对象 + form: P.any // antd的form表单高阶组件自动注入的form对象 }; /** react生命周期 - 构造函数 **/ @@ -34,13 +34,18 @@ class TestClassPageContainer extends React.Component { visible: false, // 模态框隐藏和显示 mokeFetch: [], // 用于测试fetch请求 mokeAjax: [], // 用于测试ajax请求 - count: 0, // 数字 + count: 0 // 数字 }; } /** react生命周期 - 组件初始化完毕DOM挂载完毕后 触发1次 **/ componentDidMount() { - console.log("所有页面默认拥有的3个对象:", this.props.location, this.props.match, this.props.history); + console.log( + "所有页面默认拥有的3个对象:", + this.props.location, + this.props.match, + this.props.history + ); const set = new Set([1, 2, 3]); const map = new Map(); console.log("Set 和 Map 测试:", set, map); @@ -83,7 +88,7 @@ class TestClassPageContainer extends React.Component { static getDerivedStateFromProps(nextProps, nowState) { if (nextProps.count !== nowState.count) { return { - count: nextProps.count, + count: nextProps.count }; } return null; @@ -126,14 +131,14 @@ class TestClassPageContainer extends React.Component { // 打开模态框按钮被点击时触发 onBtnClick() { this.setState({ - visible: true, + visible: true }); } // 关闭模态框 handleCancel() { this.setState({ - visible: false, + visible: false }); } @@ -142,7 +147,7 @@ class TestClassPageContainer extends React.Component { this.props.actions.serverFetch().then(res => { if (res.status === 200) { this.setState({ - mokeFetch: res.data, + mokeFetch: res.data }); } else { message.error("获取数据失败"); @@ -164,11 +169,17 @@ class TestClassPageContainer extends React.Component { 上方图片,一张是img,一张是background
- 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", + + 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", +
- 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 + + 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 +
- 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" + + 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" +

@@ -219,7 +230,10 @@ class TestClassPageContainer extends React.Component {

action测试

-
@@ -249,15 +263,36 @@ class TestClassPageContainer extends React.Component { 子页2 子页3 - - - - + + + +

- this.handleCancel()} onCancel={() => this.handleCancel()}> + this.handleCancel()} + onCancel={() => this.handleCancel()} + >

内容...

@@ -269,13 +304,13 @@ const FormComponent = Form.create()(TestClassPageContainer); export default connect( state => ({ userinfo: state.app.userinfo, // 引入app model中的userinfo数据 - count: state.test.count, // 引入test model中的count数据 + count: state.test.count // 引入test model中的count数据 }), model => ({ actions: { getUserinfo: model.app.getUserinfo, // 引入app model中的获取用户信息action onTestAdd: model.test.onTestAdd, // 引入test model中的数字+1 action - serverFetch: model.test.serverFetch, // 引入test model中的fetch异步请求action - }, - }), + serverFetch: model.test.serverFetch // 引入test model中的fetch异步请求action + } + }) )(FormComponent); From 04d3fe97115179f1a1e2149f05f377a3dc8a6f77 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Sat, 18 Jan 2020 15:39:44 +0800 Subject: [PATCH 12/98] update favicons-webpack-plugin --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 36a9f9b5..0fed9179 100644 --- a/package.json +++ b/package.json @@ -62,10 +62,10 @@ "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", "express": "^4.17.1", - "favicons-webpack-plugin": "2.0.0", + "favicons-webpack-plugin": "3.0.0", "file-loader": "^5.0.2", "happypack": "^5.0.1", - "html-webpack-plugin": "^3.2.0", + "html-webpack-plugin": "^4.0.0-beta.11", "less": "^3.10.3", "less-loader": "^5.0.0", "mini-css-extract-plugin": "^0.9.0", From 6f5b3e328282d92f71344aa41d2bfa584271a0d3 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Sat, 18 Jan 2020 15:48:12 +0800 Subject: [PATCH 13/98] update --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0fed9179..3429f7b3 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "dependencies": { "@rematch/core": "^1.3.0", "antd": "3.26.7", - "antd-dayjs-webpack-plugin": "^0.0.8", "axios": "^0.19.1", "core-js": "^3.6.4", "history": "^4.10.1", @@ -49,6 +48,7 @@ "@babel/preset-env": "^7.8.3", "@babel/preset-react": "^7.8.3", "@babel/runtime": "^7.8.3", + "antd-dayjs-webpack-plugin": "^0.0.8", "autoprefixer": "^9.7.4", "babel-eslint": "^10.0.3", "babel-loader": "^8.0.6", From 85e113948d8b56003b9150dbdfd8c36af5a84f93 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Wed, 29 Jan 2020 10:36:59 +0800 Subject: [PATCH 14/98] update package --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 3429f7b3..7eea31a5 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "dependencies": { "@rematch/core": "^1.3.0", "antd": "3.26.7", - "axios": "^0.19.1", + "axios": "^0.19.2", "core-js": "^3.6.4", "history": "^4.10.1", "lodash": "^4.17.15", @@ -74,8 +74,8 @@ "postcss-loader": "^3.0.0", "prettier": "1.19.1", "style-loader": "1.1.3", - "sw-precache-webpack-plugin": "^0.11.5", - "terser-webpack-plugin": "^2.3.2", + "sw-precache-webpack-plugin": "^1.0.0", + "terser-webpack-plugin": "^2.3.3", "url-loader": "^3.0.0", "webpack": "^4.41.5", "webpack-cli": "^3.3.10", From 14c50873f699207f739062de07be2781f7978bf6 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 3 Mar 2020 17:17:20 +0800 Subject: [PATCH 15/98] update antd 4.0 --- package.json | 34 ++++++++++----------- src/container/test/index.js | 52 +++++++++++++------------------- src/container/testclass/index.js | 8 ++--- 3 files changed, 40 insertions(+), 54 deletions(-) diff --git a/package.json b/package.json index 7eea31a5..7c77409d 100644 --- a/package.json +++ b/package.json @@ -23,21 +23,21 @@ "pnp": false }, "dependencies": { - "@rematch/core": "^1.3.0", - "antd": "3.26.7", + "@rematch/core": "^1.4.0", + "antd": "4.0.0", "axios": "^0.19.2", "core-js": "^3.6.4", "history": "^4.10.1", "lodash": "^4.17.15", - "react": "^16.12.0", - "react-dom": "^16.12.0", + "react": "^16.13.0", + "react-dom": "^16.13.0", "react-loadable": "^5.5.0", - "react-redux": "^7.1.3", + "react-redux": "^7.2.0", "react-router-dom": "^5.1.2", "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.8.3", + "@babel/core": "^7.8.6", "@babel/plugin-proposal-class-properties": "^7.8.3", "@babel/plugin-proposal-decorators": "^7.8.3", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", @@ -45,12 +45,12 @@ "@babel/plugin-proposal-optional-chaining": "^7.8.3", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-runtime": "^7.8.3", - "@babel/preset-env": "^7.8.3", + "@babel/preset-env": "^7.8.6", "@babel/preset-react": "^7.8.3", - "@babel/runtime": "^7.8.3", + "@babel/runtime": "^7.8.4", "antd-dayjs-webpack-plugin": "^0.0.8", "autoprefixer": "^9.7.4", - "babel-eslint": "^10.0.3", + "babel-eslint": "^10.1.0", "babel-loader": "^8.0.6", "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", @@ -59,14 +59,14 @@ "eslint": "^6.8.0", "eslint-loader": "^3.0.3", "eslint-plugin-prettier": "^3.1.2", - "eslint-plugin-react": "^7.18.0", - "eslint-plugin-react-hooks": "^2.3.0", + "eslint-plugin-react": "^7.18.3", + "eslint-plugin-react-hooks": "^2.5.0", "express": "^4.17.1", - "favicons-webpack-plugin": "3.0.0", - "file-loader": "^5.0.2", + "favicons-webpack-plugin": "3.0.1", + "file-loader": "^5.1.0", "happypack": "^5.0.1", "html-webpack-plugin": "^4.0.0-beta.11", - "less": "^3.10.3", + "less": "^3.11.1", "less-loader": "^5.0.0", "mini-css-extract-plugin": "^0.9.0", "mockjs": "^1.1.0", @@ -75,10 +75,10 @@ "prettier": "1.19.1", "style-loader": "1.1.3", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^2.3.3", + "terser-webpack-plugin": "^2.3.5", "url-loader": "^3.0.0", - "webpack": "^4.41.5", - "webpack-cli": "^3.3.10", + "webpack": "^4.42.0", + "webpack-cli": "^3.3.11", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", diff --git a/src/container/test/index.js b/src/container/test/index.js index c97f3f98..ce9dc320 100644 --- a/src/container/test/index.js +++ b/src/container/test/index.js @@ -21,8 +21,7 @@ function TestPageContainer({ location, // 自动注入的location对象 match, // 自动注入的match对象 history, // 自动注入的history对象 - actions, // 上面model中定义的actions对象,自动成为this.props.actions变量 - form // antd的form表单高阶组件自动注入的form对象 + actions // 上面model中定义的actions对象,自动成为this.props.actions变量 }) { const [visible, setVisible] = useState(false); // 模态框隐藏和显示 const [mokeFetch, setMokeFetch] = useState([]); // 用于测试fetch请求 @@ -70,18 +69,11 @@ function TestPageContainer({ }); } - // 表单提交登录 + // 表单提交且验证通过时触发 function handleSubmit(e) { - e.preventDefault(); - form.validateFields((err, values) => { - if (!err) { - message.success("执行了登录操作"); - } - }); + message.success("执行了登录操作"); } - const { getFieldDecorator } = form; - return (

功能测试

@@ -136,24 +128,24 @@ function TestPageContainer({

Antd表单

- - - {getFieldDecorator("username", { - rules: [{ required: true, message: "请输入用户名" }] - })( - } placeholder="用户名" /> - )} + + + } placeholder="用户名" /> - - {getFieldDecorator("password", { - rules: [{ required: true, message: "请输入密码" }] - })( - } - placeholder="密码" - /> - )} + + } + placeholder="密码" + />
- setVisible(false)} - onCancel={() => setVisible(false)} - > + setVisible(false)} onCancel={() => setVisible(false)}>

内容...

@@ -229,13 +211,13 @@ function TestPageContainer({ export default connect( state => ({ userinfo: state.app.userinfo, // 引入app model中的userinfo数据 - count: state.test.count // 引入test model中的count数据 + count: state.test.count, // 引入test model中的count数据 }), dispatch => ({ actions: { getUserinfo: dispatch.app.getUserinfo, // 引入app model中的获取用户信息action onTestAdd: dispatch.test.onTestAdd, // 引入test model中的数字+1 action - serverFetch: dispatch.test.serverFetch // 引入test model中的fetch异步请求action - } - }) + serverFetch: dispatch.test.serverFetch, // 引入test model中的fetch异步请求action + }, + }), )(TestPageContainer); From 8c4900c960796559030bf84f5521af2901d92c95 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 3 Mar 2020 17:37:00 +0800 Subject: [PATCH 17/98] Update README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index dc4c2b0d..8015bfed 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,6 @@ react automaticaly
- PWA、Hooks、代码分割、热替换、HappyPack 多线程构建、ES6+语法 -## 注意的地方 - -- antd icon 打包体积过大:https://github.com/ant-design/ant-design/issues/12011,开了 gzip 之后还行 ## 构建 Start From adee2ad41eea1c4ec0a934c4a727fdca893528cb Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 16 Apr 2020 15:19:52 +0800 Subject: [PATCH 18/98] update --- mock/mock-data.js | 6 +-- package.json | 50 +++++++++++----------- src/component/footer/index.js | 5 +-- src/component/menu/index.js | 4 +- src/container/features/index.js | 6 +-- src/container/home/index.js | 6 +-- src/container/notfound/index.js | 6 +-- src/container/routers/index.js | 24 +++++------ src/container/test/container/page1.js | 6 +-- src/container/test/container/page2.js | 6 +-- src/container/test/container/page3.js | 6 +-- src/container/test/index.js | 49 +++++++++++++++------ src/container/testclass/container/page1.js | 8 ++-- src/container/testclass/container/page2.js | 8 ++-- src/container/testclass/container/page3.js | 8 ++-- src/container/testclass/index.js | 28 ++++++------ src/models/app.js | 10 ++--- src/models/test.js | 14 +++--- src/serviceWorker.js | 10 ++--- src/store/index.js | 4 +- src/util/server.js | 4 +- src/util/tools.js | 2 +- 22 files changed, 146 insertions(+), 124 deletions(-) diff --git a/mock/mock-data.js b/mock/mock-data.js index e6a0cabf..57731942 100644 --- a/mock/mock-data.js +++ b/mock/mock-data.js @@ -8,9 +8,9 @@ const ajaxTest = { "data|1-10": [ { "id|+1": 1, - email: "@EMAIL" - } - ] + email: "@EMAIL", + }, + ], }; exports.mockApi = (url, params) => { diff --git a/package.json b/package.json index 7c77409d..26ab7a83 100644 --- a/package.json +++ b/package.json @@ -24,60 +24,60 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "4.0.0", + "antd": "4.1.3", "axios": "^0.19.2", - "core-js": "^3.6.4", + "core-js": "^3.6.5", "history": "^4.10.1", "lodash": "^4.17.15", - "react": "^16.13.0", - "react-dom": "^16.13.0", + "react": "^16.13.1", + "react-dom": "^16.13.1", "react-loadable": "^5.5.0", "react-redux": "^7.2.0", "react-router-dom": "^5.1.2", "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.8.6", + "@babel/core": "^7.9.0", "@babel/plugin-proposal-class-properties": "^7.8.3", "@babel/plugin-proposal-decorators": "^7.8.3", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-proposal-object-rest-spread": "^7.8.3", - "@babel/plugin-proposal-optional-chaining": "^7.8.3", + "@babel/plugin-proposal-object-rest-spread": "^7.9.5", + "@babel/plugin-proposal-optional-chaining": "^7.9.0", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.8.3", - "@babel/preset-env": "^7.8.6", - "@babel/preset-react": "^7.8.3", - "@babel/runtime": "^7.8.4", - "antd-dayjs-webpack-plugin": "^0.0.8", - "autoprefixer": "^9.7.4", + "@babel/plugin-transform-runtime": "^7.9.0", + "@babel/preset-env": "^7.9.5", + "@babel/preset-react": "^7.9.4", + "@babel/runtime": "^7.9.2", + "antd-dayjs-webpack-plugin": "^1.0.0", + "autoprefixer": "^9.7.6", "babel-eslint": "^10.1.0", - "babel-loader": "^8.0.6", + "babel-loader": "^8.1.0", "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "css-loader": "^3.4.2", + "css-loader": "^3.5.2", "eslint": "^6.8.0", - "eslint-loader": "^3.0.3", - "eslint-plugin-prettier": "^3.1.2", - "eslint-plugin-react": "^7.18.3", - "eslint-plugin-react-hooks": "^2.5.0", + "eslint-loader": "^4.0.0", + "eslint-plugin-prettier": "^3.1.3", + "eslint-plugin-react": "^7.19.0", + "eslint-plugin-react-hooks": "^3.0.0", "express": "^4.17.1", "favicons-webpack-plugin": "3.0.1", - "file-loader": "^5.1.0", + "file-loader": "^6.0.0", "happypack": "^5.0.1", - "html-webpack-plugin": "^4.0.0-beta.11", + "html-webpack-plugin": "^4.2.0", "less": "^3.11.1", "less-loader": "^5.0.0", "mini-css-extract-plugin": "^0.9.0", "mockjs": "^1.1.0", "optimize-css-assets-webpack-plugin": "^5.0.3", "postcss-loader": "^3.0.0", - "prettier": "1.19.1", - "style-loader": "1.1.3", + "prettier": "2.0.4", + "style-loader": "1.1.4", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^2.3.5", - "url-loader": "^3.0.0", - "webpack": "^4.42.0", + "url-loader": "^4.1.0", + "webpack": "^4.42.1", "webpack-cli": "^3.3.11", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", diff --git a/src/component/footer/index.js b/src/component/footer/index.js index 1fa99160..888ec19f 100644 --- a/src/component/footer/index.js +++ b/src/component/footer/index.js @@ -5,12 +5,11 @@ import "./index.less"; export default function Footer(props) { return (
- © 2018-2019{" "} + © 2018-2020{" "} + rel="noopener noreferrer"> isluo.com , Inc. diff --git a/src/component/menu/index.js b/src/component/menu/index.js index a47a5009..202beb9d 100644 --- a/src/component/menu/index.js +++ b/src/component/menu/index.js @@ -12,7 +12,7 @@ export default function Menu() { to={{ pathname: "/test", search: "?a=123&b=abc", - state: { c: "456", d: "ABC" } + state: { c: "456", d: "ABC" }, }} > 测试(hooks) @@ -22,7 +22,7 @@ export default function Menu() { to={{ pathname: "/testclass", search: "?a=123&b=abc", - state: { c: "456", d: "ABC" } + state: { c: "456", d: "ABC" }, }} > 测试(class) diff --git a/src/container/features/index.js b/src/container/features/index.js index b3303a50..3aa81fc8 100644 --- a/src/container/features/index.js +++ b/src/container/features/index.js @@ -59,8 +59,8 @@ function FeaturesPageContainer(props) { } export default connect( - state => ({}), - dispatch => ({ - actions: {} + (state) => ({}), + (dispatch) => ({ + actions: {}, }) )(FeaturesPageContainer); diff --git a/src/container/home/index.js b/src/container/home/index.js index 43867cbb..abda1a32 100644 --- a/src/container/home/index.js +++ b/src/container/home/index.js @@ -23,10 +23,10 @@ function HomePageContainer(props) { } export default connect( - state => { + (state) => { return {}; }, - dispatch => ({ - actions: {} + (dispatch) => ({ + actions: {}, }) )(HomePageContainer); diff --git a/src/container/notfound/index.js b/src/container/notfound/index.js index aebf1024..47f43214 100644 --- a/src/container/notfound/index.js +++ b/src/container/notfound/index.js @@ -16,8 +16,8 @@ function NotFoundPageContainer() { } export default connect( - state => ({}), - dispatch => ({ - actions: {} + (state) => ({}), + (dispatch) => ({ + actions: {}, }) )(NotFoundPageContainer); diff --git a/src/container/routers/index.js b/src/container/routers/index.js index af42916e..3861dc20 100644 --- a/src/container/routers/index.js +++ b/src/container/routers/index.js @@ -24,23 +24,23 @@ import "./index.less"; const Home = Loadable({ loader: () => import(/* webpackChunkName:'home' */ "../home"), loading: Loading, // 自定义的Loading动画组件 - timeout: 10000 // 可以设置一个超时时间(s)来应对网络慢的情况(在Loading动画组件中可以配置error信息) + timeout: 10000, // 可以设置一个超时时间(s)来应对网络慢的情况(在Loading动画组件中可以配置error信息) }); const Test = Loadable({ loader: () => import(/* webpackChunkName:'test' */ "../test"), - loading: Loading + loading: Loading, }); const TestClass = Loadable({ loader: () => import(/* webpackChunkName:'testclass' */ "../testclass"), - loading: Loading + loading: Loading, }); const Features = Loadable({ loader: () => import(/* webpackChunkName:'features' */ "../features"), - loading: Loading + loading: Loading, }); const NotFound = Loadable({ loader: () => import(/* webpackChunkName:'notfound' */ "../notfound"), - loading: Loading + loading: Loading, }); const history = createHistory(); // 实例化history对象 @@ -79,19 +79,19 @@ function RootRouterContainer(props) { onEnter(Home, props)} + render={(props) => onEnter(Home, props)} /> onEnter(Features, props)} + render={(props) => onEnter(Features, props)} /> onEnter(Test, props)} + render={(props) => onEnter(Test, props)} /> onEnter(TestClass, props)} + render={(props) => onEnter(TestClass, props)} /> @@ -108,8 +108,8 @@ function RootRouterContainer(props) { } export default connect( - state => ({}), - dispatch => ({ - actions: {} + (state) => ({}), + (dispatch) => ({ + actions: {}, }) )(RootRouterContainer); diff --git a/src/container/test/container/page1.js b/src/container/test/container/page1.js index 5751b1e9..e5ecc007 100644 --- a/src/container/test/container/page1.js +++ b/src/container/test/container/page1.js @@ -10,8 +10,8 @@ function Page1(props) { } export default connect( - state => ({}), - dispatch => ({ - actions: bindActionCreators({}, dispatch) + (state) => ({}), + (dispatch) => ({ + actions: bindActionCreators({}, dispatch), }) )(Page1); diff --git a/src/container/test/container/page2.js b/src/container/test/container/page2.js index b7a6df89..23481eec 100644 --- a/src/container/test/container/page2.js +++ b/src/container/test/container/page2.js @@ -10,8 +10,8 @@ function Page2(props) { } export default connect( - state => ({}), - dispatch => ({ - actions: bindActionCreators({}, dispatch) + (state) => ({}), + (dispatch) => ({ + actions: bindActionCreators({}, dispatch), }) )(Page2); diff --git a/src/container/test/container/page3.js b/src/container/test/container/page3.js index b26abc45..1ba9f4a1 100644 --- a/src/container/test/container/page3.js +++ b/src/container/test/container/page3.js @@ -10,8 +10,8 @@ function Page3(props) { } export default connect( - state => ({}), - dispatch => ({ - actions: bindActionCreators({}, dispatch) + (state) => ({}), + (dispatch) => ({ + actions: bindActionCreators({}, dispatch), }) )(Page3); diff --git a/src/container/test/index.js b/src/container/test/index.js index 15582274..c59e45ea 100644 --- a/src/container/test/index.js +++ b/src/container/test/index.js @@ -47,7 +47,7 @@ function TestPageContainer({ // 获取用户信息测试 actions .getUserinfo({ id: 1 }) - .then(res => { + .then((res) => { console.log("获取用户信息测试:", res); }) .catch(() => { @@ -65,7 +65,7 @@ function TestPageContainer({ // Fetch测试按钮点击时触发 function onFetchClick() { - actions.serverFetch().then(res => { + actions.serverFetch().then((res) => { if (res.status === 200) { setMokeFetch(res.data); } else { @@ -90,11 +90,17 @@ function TestPageContainer({ 上方图片,一张是img,一张是background
- 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", + + 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", +
- 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 + + 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 +
- 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" + + 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" +

@@ -128,11 +134,23 @@ function TestPageContainer({

Antd表单

- + } placeholder="用户名" /> - - } placeholder="密码" /> + + } + placeholder="密码" + />
- setVisible(false)} onCancel={() => setVisible(false)}> + setVisible(false)} + onCancel={() => setVisible(false)} + >

内容...

@@ -209,15 +232,15 @@ function TestPageContainer({ } export default connect( - state => ({ + (state) => ({ userinfo: state.app.userinfo, // 引入app model中的userinfo数据 count: state.test.count, // 引入test model中的count数据 }), - dispatch => ({ + (dispatch) => ({ actions: { getUserinfo: dispatch.app.getUserinfo, // 引入app model中的获取用户信息action onTestAdd: dispatch.test.onTestAdd, // 引入test model中的数字+1 action serverFetch: dispatch.test.serverFetch, // 引入test model中的fetch异步请求action }, - }), + }) )(TestPageContainer); diff --git a/src/container/testclass/container/page1.js b/src/container/testclass/container/page1.js index 9505220e..20143e1c 100644 --- a/src/container/testclass/container/page1.js +++ b/src/container/testclass/container/page1.js @@ -9,7 +9,7 @@ import P from "prop-types"; class Page1 extends React.Component { static propTypes = { location: P.any, - history: P.any + history: P.any, }; constructor(props) { @@ -23,8 +23,8 @@ class Page1 extends React.Component { } export default connect( - state => ({}), - dispatch => ({ - actions: bindActionCreators({}, dispatch) + (state) => ({}), + (dispatch) => ({ + actions: bindActionCreators({}, dispatch), }) )(Page1); diff --git a/src/container/testclass/container/page2.js b/src/container/testclass/container/page2.js index 48afffa7..19365bda 100644 --- a/src/container/testclass/container/page2.js +++ b/src/container/testclass/container/page2.js @@ -9,7 +9,7 @@ import P from "prop-types"; class Page2 extends React.Component { static propTypes = { location: P.any, - history: P.any + history: P.any, }; constructor(props) { @@ -23,8 +23,8 @@ class Page2 extends React.Component { } export default connect( - state => ({}), - dispatch => ({ - actions: bindActionCreators({}, dispatch) + (state) => ({}), + (dispatch) => ({ + actions: bindActionCreators({}, dispatch), }) )(Page2); diff --git a/src/container/testclass/container/page3.js b/src/container/testclass/container/page3.js index aeec4c15..316d7938 100644 --- a/src/container/testclass/container/page3.js +++ b/src/container/testclass/container/page3.js @@ -10,7 +10,7 @@ import P from "prop-types"; class Page3 extends React.Component { static propTypes = { location: P.any, - history: P.any + history: P.any, }; constructor(props) { @@ -24,8 +24,8 @@ class Page3 extends React.Component { } export default connect( - state => ({}), - dispatch => ({ - actions: bindActionCreators({}, dispatch) + (state) => ({}), + (dispatch) => ({ + actions: bindActionCreators({}, dispatch), }) )(Page3); diff --git a/src/container/testclass/index.js b/src/container/testclass/index.js index a3c0d85a..f3c58000 100644 --- a/src/container/testclass/index.js +++ b/src/container/testclass/index.js @@ -23,7 +23,7 @@ class TestClassPageContainer extends React.Component { location: P.any, // 自动注入的location对象 match: P.any, // 自动注入的match对象 history: P.any, // 自动注入的history对象 - actions: P.object // 上面model中定义的actions对象,自动成为this.props.actions变量 + actions: P.object, // 上面model中定义的actions对象,自动成为this.props.actions变量 }; /** react生命周期 - 构造函数 **/ @@ -33,7 +33,7 @@ class TestClassPageContainer extends React.Component { visible: false, // 模态框隐藏和显示 mokeFetch: [], // 用于测试fetch请求 mokeAjax: [], // 用于测试ajax请求 - count: 0 // 数字 + count: 0, // 数字 }; } @@ -56,7 +56,7 @@ class TestClassPageContainer extends React.Component { // 获取用户信息测试 this.props.actions .getUserinfo({ id: 1 }) - .then(res => { + .then((res) => { console.log("获取用户信息测试:", res); }) .catch(() => { @@ -87,7 +87,7 @@ class TestClassPageContainer extends React.Component { static getDerivedStateFromProps(nextProps, nowState) { if (nextProps.count !== nowState.count) { return { - count: nextProps.count + count: nextProps.count, }; } return null; @@ -130,23 +130,23 @@ class TestClassPageContainer extends React.Component { // 打开模态框按钮被点击时触发 onBtnClick() { this.setState({ - visible: true + visible: true, }); } // 关闭模态框 handleCancel() { this.setState({ - visible: false + visible: false, }); } // Fetch测试按钮点击时触发 onFetchClick() { - this.props.actions.serverFetch().then(res => { + this.props.actions.serverFetch().then((res) => { if (res.status === 200) { this.setState({ - mokeFetch: res.data + mokeFetch: res.data, }); } else { message.error("获取数据失败"); @@ -218,7 +218,7 @@ class TestClassPageContainer extends React.Component { state参数: {this.props.location.state ? Object.entries(this.props.location.state) - .map(v => `${v[0]}=${v[1]}`) + .map((v) => `${v[0]}=${v[1]}`) .join(",") : ""}

@@ -298,15 +298,15 @@ class TestClassPageContainer extends React.Component { } export default connect( - state => ({ + (state) => ({ userinfo: state.app.userinfo, // 引入app model中的userinfo数据 - count: state.test.count // 引入test model中的count数据 + count: state.test.count, // 引入test model中的count数据 }), - model => ({ + (model) => ({ actions: { getUserinfo: model.app.getUserinfo, // 引入app model中的获取用户信息action onTestAdd: model.test.onTestAdd, // 引入test model中的数字+1 action - serverFetch: model.test.serverFetch // 引入test model中的fetch异步请求action - } + serverFetch: model.test.serverFetch, // 引入test model中的fetch异步请求action + }, }) )(TestClassPageContainer); diff --git a/src/models/app.js b/src/models/app.js index 147b1eb3..3df7ba33 100644 --- a/src/models/app.js +++ b/src/models/app.js @@ -5,15 +5,15 @@ export default { /** store数据 **/ state: { - userinfo: null // 用户信息 + userinfo: null, // 用户信息 }, /** reducers **/ reducers: { setUserInfo(state, payload) { return Object.assign({}, state, { - userinfo: payload + userinfo: payload, }); - } + }, }, /** actions 可以是一个对象,也可以是一个函数,函数的第1个参数自动被注入dispatch **/ effects: { @@ -22,6 +22,6 @@ export default { const user = { id: params.id, username: "admin" }; this.setUserInfo(user); return user; - } - } + }, + }, }; diff --git a/src/models/test.js b/src/models/test.js index 424c3a16..8b9d2c7d 100644 --- a/src/models/test.js +++ b/src/models/test.js @@ -10,24 +10,24 @@ export default { /** store数据 **/ state: { count: 0, // 测试数字 - fetchvalue: [] // 异步请求的测试数据 + fetchvalue: [], // 异步请求的测试数据 }, /** reducers **/ reducers: { setCount(state, payload) { return Object.assign({}, state, { - count: payload + count: payload, }); }, setFetchValue(state, payload) { return Object.assign({}, state, { - fetchvalue: payload + fetchvalue: payload, }); - } + }, }, /** actions **/ - effects: dispatch => ({ + effects: (dispatch) => ({ // 测试 - 数字加1 onTestAdd(params) { this.setCount(params + 1); // 这里会指向上面reducers中的setCount @@ -43,6 +43,6 @@ export default { } catch (e) { message.error("网络错误", 1); } - } - }) + }, + }), }; diff --git a/src/serviceWorker.js b/src/serviceWorker.js index 346afec3..1bf5b0fc 100644 --- a/src/serviceWorker.js +++ b/src/serviceWorker.js @@ -57,7 +57,7 @@ export function register(config) { function registerValidSW(swUrl, config) { navigator.serviceWorker .register(swUrl) - .then(registration => { + .then((registration) => { registration.onupdatefound = () => { const installingWorker = registration.installing; if (installingWorker == null) { @@ -93,7 +93,7 @@ function registerValidSW(swUrl, config) { }; }; }) - .catch(error => { + .catch((error) => { console.error("Error during service worker registration:", error); }); } @@ -101,7 +101,7 @@ function registerValidSW(swUrl, config) { function checkValidServiceWorker(swUrl, config) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl) - .then(response => { + .then((response) => { // Ensure service worker exists, and that we really are getting a JS file. const contentType = response.headers.get("content-type"); if ( @@ -109,7 +109,7 @@ function checkValidServiceWorker(swUrl, config) { (contentType != null && contentType.indexOf("javascript") === -1) ) { // No service worker found. Probably a different app. Reload the page. - navigator.serviceWorker.ready.then(registration => { + navigator.serviceWorker.ready.then((registration) => { registration.unregister().then(() => { window.location.reload(); }); @@ -128,7 +128,7 @@ function checkValidServiceWorker(swUrl, config) { export function unregister() { if ("serviceWorker" in navigator) { - navigator.serviceWorker.ready.then(registration => { + navigator.serviceWorker.ready.then((registration) => { registration.unregister(); }); } diff --git a/src/store/index.js b/src/store/index.js index 49e2c30b..16efc3f3 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -7,6 +7,6 @@ import test from "../models/test"; export default init({ models: { app, // 这里的命名很重要,即这个模块的名字 - test - } + test, + }, }); diff --git a/src/util/server.js b/src/util/server.js index ff7892c1..277062d8 100644 --- a/src/util/server.js +++ b/src/util/server.js @@ -11,10 +11,10 @@ export default class ApiService { url, method: type, headers: { - "Content-Type": "application/json;charset=utf-8" + "Content-Type": "application/json;charset=utf-8", }, withCredentials: true, - data: JSON.stringify(bodyObj) + data: JSON.stringify(bodyObj), }); } } diff --git a/src/util/tools.js b/src/util/tools.js index 9df7f61e..c605680a 100644 --- a/src/util/tools.js +++ b/src/util/tools.js @@ -78,7 +78,7 @@ const tools = { } console.log("解谜:", code, c); return c; - } + }, }; export default tools; From e3dadcbb5cffa364f4f4c3249cb38fa699ee620f Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Mon, 27 Apr 2020 16:47:41 +0800 Subject: [PATCH 19/98] update --- package.json | 16 ++++++++-------- src/component/footer/index.js | 3 ++- webpack.dev.config.js | 10 +++++++++- webpack.production.config.js | 18 +++++++++++++++--- 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 26ab7a83..0ba45c7c 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "4.1.3", + "antd": "4.1.5", "axios": "^0.19.2", "core-js": "^3.6.5", "history": "^4.10.1", @@ -55,9 +55,9 @@ "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "css-loader": "^3.5.2", + "css-loader": "^3.5.3", "eslint": "^6.8.0", - "eslint-loader": "^4.0.0", + "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.3", "eslint-plugin-react": "^7.19.0", "eslint-plugin-react-hooks": "^3.0.0", @@ -67,17 +67,17 @@ "happypack": "^5.0.1", "html-webpack-plugin": "^4.2.0", "less": "^3.11.1", - "less-loader": "^5.0.0", + "less-loader": "^6.0.0", "mini-css-extract-plugin": "^0.9.0", "mockjs": "^1.1.0", "optimize-css-assets-webpack-plugin": "^5.0.3", "postcss-loader": "^3.0.0", - "prettier": "2.0.4", - "style-loader": "1.1.4", + "prettier": "2.0.5", + "style-loader": "1.2.0", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^2.3.5", + "terser-webpack-plugin": "^2.3.6", "url-loader": "^4.1.0", - "webpack": "^4.42.1", + "webpack": "^4.43.0", "webpack-cli": "^3.3.11", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", diff --git a/src/component/footer/index.js b/src/component/footer/index.js index 888ec19f..d1cd7345 100644 --- a/src/component/footer/index.js +++ b/src/component/footer/index.js @@ -9,7 +9,8 @@ export default function Footer(props) { + rel="noopener noreferrer" + > isluo.com , Inc. diff --git a/webpack.dev.config.js b/webpack.dev.config.js index f87a3517..4b8bfc96 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -47,7 +47,15 @@ module.exports = { { // .less 解析 test: /\.less$/, - use: ["style-loader", "css-loader", "postcss-loader", { loader: "less-loader", options: { javascriptEnabled: true } }], + use: [ + "style-loader", + "css-loader", + "postcss-loader", + { + loader: "less-loader", + options: { lessOptions: { javascriptEnabled: true } }, + }, + ], }, { // 文件解析 diff --git a/webpack.production.config.js b/webpack.production.config.js index 046e0432..f8060b09 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -29,7 +29,7 @@ module.exports = { chunkFilename: "dist/[name].[chunkhash:8].chunk.js", }, stats: { - warningsFilter: warning => /Conflicting order/gm.test(warning), // 不输出一些警告,多为因CSS引入顺序不同导致的警告 + warningsFilter: (warning) => /Conflicting order/gm.test(warning), // 不输出一些警告,多为因CSS引入顺序不同导致的警告 children: false, // 不输出子模块的打包信息 }, optimization: { @@ -67,7 +67,15 @@ module.exports = { { // .less 解析 test: /\.less$/, - use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader", { loader: "less-loader", options: { javascriptEnabled: true } }], + use: [ + MiniCssExtractPlugin.loader, + "css-loader", + "postcss-loader", + { + loader: "less-loader", + options: { lessOptions: { javascriptEnabled: true } }, + }, + ], }, { // 文件解析 @@ -150,7 +158,11 @@ module.exports = { minify: true, // 压缩 navigateFallback: PUBLIC_PATH, // 遇到不存在的URL时,跳转到主页 navigateFallbackWhitelist: [/^(?!\/__).*/], // 忽略从/__开始的网址,参考 https://github.com/facebookincubator/create-react-app/issues/2237#issuecomment-302693219 - staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/, /\.cache$/], // 不缓存sourcemaps,它们太大了 + staticFileGlobsIgnorePatterns: [ + /\.map$/, + /asset-manifest\.json$/, + /\.cache$/, + ], // 不缓存sourcemaps,它们太大了 }), /** * 自动生成HTML,并注入各参数 From ac81870e6e9a533748bd24eb92fb75d9d434b4b5 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 7 May 2020 10:22:06 +0800 Subject: [PATCH 20/98] update --- .gitignore | 1 + package.json | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 5479b62d..060f3df3 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ jspm_packages build .happypack yarn.lock +.vscode/* dll # Optional npm cache directory diff --git a/package.json b/package.json index 0ba45c7c..0b72de60 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "4.1.5", + "antd": "4.2.0", "axios": "^0.19.2", "core-js": "^3.6.5", "history": "^4.10.1", @@ -37,17 +37,17 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.9.0", + "@babel/core": "^7.9.6", "@babel/plugin-proposal-class-properties": "^7.8.3", "@babel/plugin-proposal-decorators": "^7.8.3", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-proposal-object-rest-spread": "^7.9.5", + "@babel/plugin-proposal-object-rest-spread": "^7.9.6", "@babel/plugin-proposal-optional-chaining": "^7.9.0", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.9.0", - "@babel/preset-env": "^7.9.5", + "@babel/plugin-transform-runtime": "^7.9.6", + "@babel/preset-env": "^7.9.6", "@babel/preset-react": "^7.9.4", - "@babel/runtime": "^7.9.2", + "@babel/runtime": "^7.9.6", "antd-dayjs-webpack-plugin": "^1.0.0", "autoprefixer": "^9.7.6", "babel-eslint": "^10.1.0", @@ -60,12 +60,12 @@ "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.3", "eslint-plugin-react": "^7.19.0", - "eslint-plugin-react-hooks": "^3.0.0", + "eslint-plugin-react-hooks": "^4.0.0", "express": "^4.17.1", "favicons-webpack-plugin": "3.0.1", "file-loader": "^6.0.0", "happypack": "^5.0.1", - "html-webpack-plugin": "^4.2.0", + "html-webpack-plugin": "^4.3.0", "less": "^3.11.1", "less-loader": "^6.0.0", "mini-css-extract-plugin": "^0.9.0", @@ -73,9 +73,9 @@ "optimize-css-assets-webpack-plugin": "^5.0.3", "postcss-loader": "^3.0.0", "prettier": "2.0.5", - "style-loader": "1.2.0", + "style-loader": "1.2.1", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^2.3.6", + "terser-webpack-plugin": "^3.0.1", "url-loader": "^4.1.0", "webpack": "^4.43.0", "webpack-cli": "^3.3.11", From a255741ba1ef478d2a65283c01bccf6537c9ce80 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 21 May 2020 15:10:11 +0800 Subject: [PATCH 21/98] update --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 0b72de60..83b01895 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "4.2.0", + "antd": "4.2.4", "axios": "^0.19.2", "core-js": "^3.6.5", "history": "^4.10.1", @@ -33,7 +33,7 @@ "react-dom": "^16.13.1", "react-loadable": "^5.5.0", "react-redux": "^7.2.0", - "react-router-dom": "^5.1.2", + "react-router-dom": "^5.2.0", "redux": "^4.0.5" }, "devDependencies": { @@ -49,25 +49,25 @@ "@babel/preset-react": "^7.9.4", "@babel/runtime": "^7.9.6", "antd-dayjs-webpack-plugin": "^1.0.0", - "autoprefixer": "^9.7.6", + "autoprefixer": "^9.8.0", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "css-loader": "^3.5.3", - "eslint": "^6.8.0", + "eslint": "^7.0.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.3", - "eslint-plugin-react": "^7.19.0", - "eslint-plugin-react-hooks": "^4.0.0", + "eslint-plugin-react": "^7.20.0", + "eslint-plugin-react-hooks": "^4.0.2", "express": "^4.17.1", "favicons-webpack-plugin": "3.0.1", "file-loader": "^6.0.0", "happypack": "^5.0.1", "html-webpack-plugin": "^4.3.0", "less": "^3.11.1", - "less-loader": "^6.0.0", + "less-loader": "^6.1.0", "mini-css-extract-plugin": "^0.9.0", "mockjs": "^1.1.0", "optimize-css-assets-webpack-plugin": "^5.0.3", From f01a85534cf4a49510a2ded0e3b83c8947fd652c Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Mon, 1 Jun 2020 10:59:45 +0800 Subject: [PATCH 22/98] update --- package.json | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 83b01895..3467855d 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "4.2.4", + "antd": "4.3.0", "axios": "^0.19.2", "core-js": "^3.6.5", "history": "^4.10.1", @@ -37,17 +37,17 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.9.6", - "@babel/plugin-proposal-class-properties": "^7.8.3", - "@babel/plugin-proposal-decorators": "^7.8.3", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-proposal-object-rest-spread": "^7.9.6", - "@babel/plugin-proposal-optional-chaining": "^7.9.0", + "@babel/core": "^7.10.2", + "@babel/plugin-proposal-class-properties": "^7.10.1", + "@babel/plugin-proposal-decorators": "^7.10.1", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1", + "@babel/plugin-proposal-object-rest-spread": "^7.10.1", + "@babel/plugin-proposal-optional-chaining": "^7.10.1", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.9.6", - "@babel/preset-env": "^7.9.6", - "@babel/preset-react": "^7.9.4", - "@babel/runtime": "^7.9.6", + "@babel/plugin-transform-runtime": "^7.10.1", + "@babel/preset-env": "^7.10.2", + "@babel/preset-react": "^7.10.1", + "@babel/runtime": "^7.10.2", "antd-dayjs-webpack-plugin": "^1.0.0", "autoprefixer": "^9.8.0", "babel-eslint": "^10.1.0", @@ -56,17 +56,17 @@ "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "css-loader": "^3.5.3", - "eslint": "^7.0.0", + "eslint": "^7.1.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.3", "eslint-plugin-react": "^7.20.0", - "eslint-plugin-react-hooks": "^4.0.2", + "eslint-plugin-react-hooks": "^4.0.4", "express": "^4.17.1", "favicons-webpack-plugin": "3.0.1", "file-loader": "^6.0.0", "happypack": "^5.0.1", "html-webpack-plugin": "^4.3.0", - "less": "^3.11.1", + "less": "^3.11.2", "less-loader": "^6.1.0", "mini-css-extract-plugin": "^0.9.0", "mockjs": "^1.1.0", @@ -75,7 +75,7 @@ "prettier": "2.0.5", "style-loader": "1.2.1", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^3.0.1", + "terser-webpack-plugin": "^3.0.2", "url-loader": "^4.1.0", "webpack": "^4.43.0", "webpack-cli": "^3.3.11", From 139d3b7446da1de258eb54cd4b7ba118ec43f678 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Wed, 24 Jun 2020 11:53:46 +0800 Subject: [PATCH 23/98] update --- package.json | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 3467855d..52521b94 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "4.3.0", + "antd": "4.3.5", "axios": "^0.19.2", "core-js": "^3.6.5", "history": "^4.10.1", @@ -37,28 +37,28 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.10.2", + "@babel/core": "^7.10.3", "@babel/plugin-proposal-class-properties": "^7.10.1", - "@babel/plugin-proposal-decorators": "^7.10.1", + "@babel/plugin-proposal-decorators": "^7.10.3", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1", - "@babel/plugin-proposal-object-rest-spread": "^7.10.1", - "@babel/plugin-proposal-optional-chaining": "^7.10.1", + "@babel/plugin-proposal-object-rest-spread": "^7.10.3", + "@babel/plugin-proposal-optional-chaining": "^7.10.3", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.10.1", - "@babel/preset-env": "^7.10.2", + "@babel/plugin-transform-runtime": "^7.10.3", + "@babel/preset-env": "^7.10.3", "@babel/preset-react": "^7.10.1", - "@babel/runtime": "^7.10.2", + "@babel/runtime": "^7.10.3", "antd-dayjs-webpack-plugin": "^1.0.0", - "autoprefixer": "^9.8.0", + "autoprefixer": "^9.8.4", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "css-loader": "^3.5.3", - "eslint": "^7.1.0", + "css-loader": "^3.6.0", + "eslint": "^7.3.1", "eslint-loader": "^4.0.2", - "eslint-plugin-prettier": "^3.1.3", + "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.20.0", "eslint-plugin-react-hooks": "^4.0.4", "express": "^4.17.1", @@ -66,8 +66,8 @@ "file-loader": "^6.0.0", "happypack": "^5.0.1", "html-webpack-plugin": "^4.3.0", - "less": "^3.11.2", - "less-loader": "^6.1.0", + "less": "^3.11.3", + "less-loader": "^6.1.2", "mini-css-extract-plugin": "^0.9.0", "mockjs": "^1.1.0", "optimize-css-assets-webpack-plugin": "^5.0.3", @@ -75,10 +75,10 @@ "prettier": "2.0.5", "style-loader": "1.2.1", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^3.0.2", + "terser-webpack-plugin": "^3.0.6", "url-loader": "^4.1.0", "webpack": "^4.43.0", - "webpack-cli": "^3.3.11", + "webpack-cli": "^3.3.12", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", From 3b706def1f21250963b9e8f5cacfeb573d4138c0 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Wed, 24 Jun 2020 11:59:16 +0800 Subject: [PATCH 24/98] update --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 72bfaf33..11823731 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: + - "12" - "10" - - "8" script: - yarn build From 8a49bf7e31e8d6cb1eaf336c95226cb4e78864aa Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 9 Jul 2020 14:46:37 +0800 Subject: [PATCH 25/98] update package --- package.json | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 52521b94..1a381dc2 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,11 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "4.3.5", + "antd": "4.4.1", "axios": "^0.19.2", "core-js": "^3.6.5", "history": "^4.10.1", - "lodash": "^4.17.15", + "lodash": "^4.17.19", "react": "^16.13.1", "react-dom": "^16.13.1", "react-loadable": "^5.5.0", @@ -37,17 +37,17 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.10.3", - "@babel/plugin-proposal-class-properties": "^7.10.1", - "@babel/plugin-proposal-decorators": "^7.10.3", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1", - "@babel/plugin-proposal-object-rest-spread": "^7.10.3", - "@babel/plugin-proposal-optional-chaining": "^7.10.3", + "@babel/core": "^7.10.4", + "@babel/plugin-proposal-class-properties": "^7.10.4", + "@babel/plugin-proposal-decorators": "^7.10.4", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4", + "@babel/plugin-proposal-object-rest-spread": "^7.10.4", + "@babel/plugin-proposal-optional-chaining": "^7.10.4", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.10.3", - "@babel/preset-env": "^7.10.3", - "@babel/preset-react": "^7.10.1", - "@babel/runtime": "^7.10.3", + "@babel/plugin-transform-runtime": "^7.10.4", + "@babel/preset-env": "^7.10.4", + "@babel/preset-react": "^7.10.4", + "@babel/runtime": "^7.10.4", "antd-dayjs-webpack-plugin": "^1.0.0", "autoprefixer": "^9.8.4", "babel-eslint": "^10.1.0", @@ -56,18 +56,18 @@ "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "css-loader": "^3.6.0", - "eslint": "^7.3.1", + "eslint": "^7.4.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", - "eslint-plugin-react": "^7.20.0", - "eslint-plugin-react-hooks": "^4.0.4", + "eslint-plugin-react": "^7.20.3", + "eslint-plugin-react-hooks": "^4.0.6", "express": "^4.17.1", "favicons-webpack-plugin": "3.0.1", "file-loader": "^6.0.0", "happypack": "^5.0.1", "html-webpack-plugin": "^4.3.0", "less": "^3.11.3", - "less-loader": "^6.1.2", + "less-loader": "^6.2.0", "mini-css-extract-plugin": "^0.9.0", "mockjs": "^1.1.0", "optimize-css-assets-webpack-plugin": "^5.0.3", From ffee58cdbae44e8251d9f26e903fbd973fcec9bb Mon Sep 17 00:00:00 2001 From: LOGIC <376693576@qq.com> Date: Fri, 17 Jul 2020 18:15:18 +0800 Subject: [PATCH 26/98] update package --- package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 1a381dc2..5e3ed64f 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "4.4.1", + "antd": "4.4.2", "axios": "^0.19.2", "core-js": "^3.6.5", "history": "^4.10.1", @@ -37,19 +37,19 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.10.4", + "@babel/core": "^7.10.5", "@babel/plugin-proposal-class-properties": "^7.10.4", - "@babel/plugin-proposal-decorators": "^7.10.4", + "@babel/plugin-proposal-decorators": "^7.10.5", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4", "@babel/plugin-proposal-object-rest-spread": "^7.10.4", "@babel/plugin-proposal-optional-chaining": "^7.10.4", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.10.4", + "@babel/plugin-transform-runtime": "^7.10.5", "@babel/preset-env": "^7.10.4", "@babel/preset-react": "^7.10.4", - "@babel/runtime": "^7.10.4", + "@babel/runtime": "^7.10.5", "antd-dayjs-webpack-plugin": "^1.0.0", - "autoprefixer": "^9.8.4", + "autoprefixer": "^9.8.5", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "babel-plugin-import": "^1.13.0", @@ -60,13 +60,13 @@ "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.20.3", - "eslint-plugin-react-hooks": "^4.0.6", + "eslint-plugin-react-hooks": "^4.0.8", "express": "^4.17.1", "favicons-webpack-plugin": "3.0.1", "file-loader": "^6.0.0", "happypack": "^5.0.1", "html-webpack-plugin": "^4.3.0", - "less": "^3.11.3", + "less": "^3.12.2", "less-loader": "^6.2.0", "mini-css-extract-plugin": "^0.9.0", "mockjs": "^1.1.0", @@ -75,7 +75,7 @@ "prettier": "2.0.5", "style-loader": "1.2.1", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^3.0.6", + "terser-webpack-plugin": "^3.0.7", "url-loader": "^4.1.0", "webpack": "^4.43.0", "webpack-cli": "^3.3.12", From 1815d3949ed564f91212ebb2469bcd899419bbba Mon Sep 17 00:00:00 2001 From: LOGIC <376693576@qq.com> Date: Mon, 3 Aug 2020 18:42:46 +0800 Subject: [PATCH 27/98] update package --- package.json | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 5e3ed64f..49894a6e 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "4.4.2", + "antd": "4.5.2", "axios": "^0.19.2", "core-js": "^3.6.5", "history": "^4.10.1", @@ -32,37 +32,37 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-loadable": "^5.5.0", - "react-redux": "^7.2.0", + "react-redux": "^7.2.1", "react-router-dom": "^5.2.0", "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.10.5", + "@babel/core": "^7.11.0", "@babel/plugin-proposal-class-properties": "^7.10.4", "@babel/plugin-proposal-decorators": "^7.10.5", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4", - "@babel/plugin-proposal-object-rest-spread": "^7.10.4", - "@babel/plugin-proposal-optional-chaining": "^7.10.4", + "@babel/plugin-proposal-object-rest-spread": "^7.11.0", + "@babel/plugin-proposal-optional-chaining": "^7.11.0", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.10.5", - "@babel/preset-env": "^7.10.4", + "@babel/plugin-transform-runtime": "^7.11.0", + "@babel/preset-env": "^7.11.0", "@babel/preset-react": "^7.10.4", - "@babel/runtime": "^7.10.5", - "antd-dayjs-webpack-plugin": "^1.0.0", - "autoprefixer": "^9.8.5", + "@babel/runtime": "^7.11.0", + "antd-dayjs-webpack-plugin": "^1.0.1", + "autoprefixer": "^9.8.6", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "css-loader": "^3.6.0", - "eslint": "^7.4.0", + "css-loader": "^4.2.0", + "eslint": "^7.6.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", - "eslint-plugin-react": "^7.20.3", + "eslint-plugin-react": "^7.20.5", "eslint-plugin-react-hooks": "^4.0.8", "express": "^4.17.1", - "favicons-webpack-plugin": "3.0.1", + "favicons-webpack-plugin": "4.2.0", "file-loader": "^6.0.0", "happypack": "^5.0.1", "html-webpack-plugin": "^4.3.0", @@ -75,9 +75,9 @@ "prettier": "2.0.5", "style-loader": "1.2.1", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^3.0.7", + "terser-webpack-plugin": "^3.0.8", "url-loader": "^4.1.0", - "webpack": "^4.43.0", + "webpack": "^4.44.1", "webpack-cli": "^3.3.12", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", From 99489a69d5530352002f3fb158e14892a359bc9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Here=C3=B1=C3=BA?= Date: Mon, 10 Aug 2020 12:40:28 -0300 Subject: [PATCH 28/98] Syntax issue on line 09 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8015bfed..89c6ca38 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ## what is this? -react automaticaly
+react automatically
这是一个 React 脚手架,没有使用 create-react-app
标准的 React+Redux 分层结构
经过了多个项目的实践,不停的更新和优化出来的。目前自己做项目也在用。 From 71486114a8b46dd50b5104d838a663a04331dcda Mon Sep 17 00:00:00 2001 From: LOGIC <376693576@qq.com> Date: Wed, 12 Aug 2020 16:51:28 +0800 Subject: [PATCH 29/98] update package --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 49894a6e..1e1bc294 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "4.5.2", + "antd": "4.5.3", "axios": "^0.19.2", "core-js": "^3.6.5", "history": "^4.10.1", @@ -37,7 +37,7 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.11.0", + "@babel/core": "^7.11.1", "@babel/plugin-proposal-class-properties": "^7.10.4", "@babel/plugin-proposal-decorators": "^7.10.5", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4", @@ -47,7 +47,7 @@ "@babel/plugin-transform-runtime": "^7.11.0", "@babel/preset-env": "^7.11.0", "@babel/preset-react": "^7.10.4", - "@babel/runtime": "^7.11.0", + "@babel/runtime": "^7.11.2", "antd-dayjs-webpack-plugin": "^1.0.1", "autoprefixer": "^9.8.6", "babel-eslint": "^10.1.0", @@ -55,7 +55,7 @@ "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "css-loader": "^4.2.0", + "css-loader": "^4.2.1", "eslint": "^7.6.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", @@ -68,14 +68,14 @@ "html-webpack-plugin": "^4.3.0", "less": "^3.12.2", "less-loader": "^6.2.0", - "mini-css-extract-plugin": "^0.9.0", + "mini-css-extract-plugin": "^0.10.0", "mockjs": "^1.1.0", "optimize-css-assets-webpack-plugin": "^5.0.3", "postcss-loader": "^3.0.0", "prettier": "2.0.5", "style-loader": "1.2.1", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^3.0.8", + "terser-webpack-plugin": "^4.1.0", "url-loader": "^4.1.0", "webpack": "^4.44.1", "webpack-cli": "^3.3.12", From a54ba41924fc946293e6390c581f97b69afdfd68 Mon Sep 17 00:00:00 2001 From: LOGIC <376693576@qq.com> Date: Tue, 8 Sep 2020 20:48:06 +0800 Subject: [PATCH 30/98] update package --- package.json | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 1e1bc294..1094bd73 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,11 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "4.5.3", - "axios": "^0.19.2", + "antd": "4.6.3", + "axios": "^0.20.0", "core-js": "^3.6.5", "history": "^4.10.1", - "lodash": "^4.17.19", + "lodash": "^4.17.20", "react": "^16.13.1", "react-dom": "^16.13.1", "react-loadable": "^5.5.0", @@ -37,15 +37,15 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.11.1", + "@babel/core": "^7.11.6", "@babel/plugin-proposal-class-properties": "^7.10.4", "@babel/plugin-proposal-decorators": "^7.10.5", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4", "@babel/plugin-proposal-object-rest-spread": "^7.11.0", "@babel/plugin-proposal-optional-chaining": "^7.11.0", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.11.0", - "@babel/preset-env": "^7.11.0", + "@babel/plugin-transform-runtime": "^7.11.5", + "@babel/preset-env": "^7.11.5", "@babel/preset-react": "^7.10.4", "@babel/runtime": "^7.11.2", "antd-dayjs-webpack-plugin": "^1.0.1", @@ -55,24 +55,24 @@ "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "css-loader": "^4.2.1", - "eslint": "^7.6.0", + "css-loader": "^4.2.2", + "eslint": "^7.8.1", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", - "eslint-plugin-react": "^7.20.5", - "eslint-plugin-react-hooks": "^4.0.8", + "eslint-plugin-react": "^7.20.6", + "eslint-plugin-react-hooks": "^4.1.0", "express": "^4.17.1", "favicons-webpack-plugin": "4.2.0", - "file-loader": "^6.0.0", + "file-loader": "^6.1.0", "happypack": "^5.0.1", - "html-webpack-plugin": "^4.3.0", + "html-webpack-plugin": "^4.4.1", "less": "^3.12.2", - "less-loader": "^6.2.0", - "mini-css-extract-plugin": "^0.10.0", + "less-loader": "^7.0.1", + "mini-css-extract-plugin": "^0.11.0", "mockjs": "^1.1.0", - "optimize-css-assets-webpack-plugin": "^5.0.3", - "postcss-loader": "^3.0.0", - "prettier": "2.0.5", + "optimize-css-assets-webpack-plugin": "^5.0.4", + "postcss-loader": "^4.0.0", + "prettier": "2.1.1", "style-loader": "1.2.1", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^4.1.0", From 5a155c4d3bf997d180a7cc7b4c9dcd23e7b0ab16 Mon Sep 17 00:00:00 2001 From: LOGIC <376693576@qq.com> Date: Wed, 16 Sep 2020 11:08:56 +0800 Subject: [PATCH 31/98] update packages --- package.json | 18 +++++++++--------- postcss.config.js | 4 +++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 1094bd73..6440635c 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "4.6.3", + "antd": "4.6.4", "axios": "^0.20.0", "core-js": "^3.6.5", "history": "^4.10.1", @@ -49,18 +49,18 @@ "@babel/preset-react": "^7.10.4", "@babel/runtime": "^7.11.2", "antd-dayjs-webpack-plugin": "^1.0.1", - "autoprefixer": "^9.8.6", + "autoprefixer": "9.8.6", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "css-loader": "^4.2.2", - "eslint": "^7.8.1", + "css-loader": "^4.3.0", + "eslint": "^7.9.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.20.6", - "eslint-plugin-react-hooks": "^4.1.0", + "eslint-plugin-react-hooks": "^4.1.2", "express": "^4.17.1", "favicons-webpack-plugin": "4.2.0", "file-loader": "^6.1.0", @@ -68,14 +68,14 @@ "html-webpack-plugin": "^4.4.1", "less": "^3.12.2", "less-loader": "^7.0.1", - "mini-css-extract-plugin": "^0.11.0", + "mini-css-extract-plugin": "^0.11.2", "mockjs": "^1.1.0", "optimize-css-assets-webpack-plugin": "^5.0.4", - "postcss-loader": "^4.0.0", - "prettier": "2.1.1", + "postcss-loader": "^4.0.2", + "prettier": "2.1.2", "style-loader": "1.2.1", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^4.1.0", + "terser-webpack-plugin": "^4.2.1", "url-loader": "^4.1.0", "webpack": "^4.44.1", "webpack-cli": "^3.3.12", diff --git a/postcss.config.js b/postcss.config.js index 796abe22..fe843fae 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,4 +1,6 @@ /** postcss-loader 解析器所需的配置文件 **/ module.exports = { - plugins: [require("autoprefixer")()] + plugins: [ + require('autoprefixer')() + ] }; From d4dd4de57009c00aa1e5f8b538e19f0266015d57 Mon Sep 17 00:00:00 2001 From: LOGIC <376693576@qq.com> Date: Fri, 9 Oct 2020 10:59:12 +0800 Subject: [PATCH 32/98] update packages --- package.json | 20 ++++++++++---------- server.js | 8 ++++---- src/models/test.js | 6 +++++- src/util/server.js | 5 +++-- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 6440635c..19e6a38c 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "4.6.4", + "antd": "^4.6.6", "axios": "^0.20.0", "core-js": "^3.6.5", "history": "^4.10.1", @@ -49,35 +49,35 @@ "@babel/preset-react": "^7.10.4", "@babel/runtime": "^7.11.2", "antd-dayjs-webpack-plugin": "^1.0.1", - "autoprefixer": "9.8.6", + "autoprefixer": "^9.8.6", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "babel-plugin-import": "^1.13.0", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "css-loader": "^4.3.0", - "eslint": "^7.9.0", + "eslint": "^7.10.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", - "eslint-plugin-react": "^7.20.6", + "eslint-plugin-react": "^7.21.3", "eslint-plugin-react-hooks": "^4.1.2", "express": "^4.17.1", "favicons-webpack-plugin": "4.2.0", "file-loader": "^6.1.0", "happypack": "^5.0.1", - "html-webpack-plugin": "^4.4.1", + "html-webpack-plugin": "^4.5.0", "less": "^3.12.2", "less-loader": "^7.0.1", - "mini-css-extract-plugin": "^0.11.2", + "mini-css-extract-plugin": "^0.12.0", "mockjs": "^1.1.0", "optimize-css-assets-webpack-plugin": "^5.0.4", - "postcss-loader": "^4.0.2", + "postcss-loader": "^4.0.3", "prettier": "2.1.2", - "style-loader": "1.2.1", + "style-loader": "1.3.0", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^4.2.1", + "terser-webpack-plugin": "^4.2.3", "url-loader": "^4.1.0", - "webpack": "^4.44.1", + "webpack": "^4.44.2", "webpack-cli": "^3.3.12", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", diff --git a/server.js b/server.js index 9ff59022..52ccb9ce 100644 --- a/server.js +++ b/server.js @@ -56,10 +56,10 @@ if (env === "production") { } /** 监听POST请求,返回MOCK模拟数据 **/ -app.post("*", (req, res, next) => { - const result = mock.mockApi(req.originalUrl, req.body); - res.send(result); -}); +// app.post("*", (req, res, next) => { +// const result = mock.mockApi(req.originalUrl, req.body); +// res.send(result); +// }); /** 启动服务 **/ app.listen(PORT, () => { diff --git a/src/models/test.js b/src/models/test.js index 8b9d2c7d..5c723d1f 100644 --- a/src/models/test.js +++ b/src/models/test.js @@ -35,7 +35,11 @@ export default { // 测试 - 异步请求 async serverFetch(params = {}) { try { - const res = await Server.newServer("url.ajax", params, "post"); + const res = await Server.newServer( + "url.ajax", + { a: 123, b: "456" }, + "post" + ); if (res && res.data.status === 200) { dispatch({ type: "test/setFetchValue", payload: res.data.data }); // dispatch是全局根dispatch,也能这么用 } diff --git a/src/util/server.js b/src/util/server.js index 277062d8..f67b7de4 100644 --- a/src/util/server.js +++ b/src/util/server.js @@ -4,6 +4,7 @@ * **/ import axios from "axios"; +import qs from "qs"; export default class ApiService { static newServer(url, bodyObj = {}, type = "post") { @@ -11,10 +12,10 @@ export default class ApiService { url, method: type, headers: { - "Content-Type": "application/json;charset=utf-8", + "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", }, withCredentials: true, - data: JSON.stringify(bodyObj), + data: qs.stringify(bodyObj), }); } } From dabaa21f67b937ef9275c3bcce3707ba06e6c6dc Mon Sep 17 00:00:00 2001 From: LOGIC <376693576@qq.com> Date: Sun, 18 Oct 2020 22:56:23 +0800 Subject: [PATCH 33/98] update autoprefixer 10.x --- package.json | 55 +++++++++++++++++----------------- postcss.config.js | 2 +- src/container/routers/index.js | 1 + webpack.dev.config.js | 2 +- 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index 19e6a38c..bf33c247 100644 --- a/package.json +++ b/package.json @@ -24,61 +24,62 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.6.6", + "antd": "^4.7.0", "axios": "^0.20.0", "core-js": "^3.6.5", "history": "^4.10.1", "lodash": "^4.17.20", - "react": "^16.13.1", - "react-dom": "^16.13.1", + "react": "^16.14.0", + "react-dom": "^16.14.0", "react-loadable": "^5.5.0", "react-redux": "^7.2.1", "react-router-dom": "^5.2.0", "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.11.6", - "@babel/plugin-proposal-class-properties": "^7.10.4", - "@babel/plugin-proposal-decorators": "^7.10.5", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4", - "@babel/plugin-proposal-object-rest-spread": "^7.11.0", - "@babel/plugin-proposal-optional-chaining": "^7.11.0", + "@babel/core": "7.12.3", + "@babel/plugin-proposal-class-properties": "^7.12.1", + "@babel/plugin-proposal-decorators": "^7.12.1", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1", + "@babel/plugin-proposal-object-rest-spread": "^7.12.1", + "@babel/plugin-proposal-optional-chaining": "^7.12.1", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.11.5", - "@babel/preset-env": "^7.11.5", - "@babel/preset-react": "^7.10.4", - "@babel/runtime": "^7.11.2", + "@babel/plugin-transform-runtime": "^7.12.1", + "@babel/preset-env": "^7.12.1", + "@babel/preset-react": "^7.12.1", + "@babel/runtime": "^7.12.1", "antd-dayjs-webpack-plugin": "^1.0.1", - "autoprefixer": "^9.8.6", + "autoprefixer": "^10.0.1", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", - "babel-plugin-import": "^1.13.0", + "babel-plugin-import": "^1.13.1", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "css-loader": "^4.3.0", - "eslint": "^7.10.0", + "css-loader": "5.0.0", + "eslint": "^7.11.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", - "eslint-plugin-react": "^7.21.3", + "eslint-plugin-react": "^7.21.4", "eslint-plugin-react-hooks": "^4.1.2", "express": "^4.17.1", "favicons-webpack-plugin": "4.2.0", - "file-loader": "^6.1.0", + "file-loader": "^6.1.1", "happypack": "^5.0.1", "html-webpack-plugin": "^4.5.0", "less": "^3.12.2", - "less-loader": "^7.0.1", - "mini-css-extract-plugin": "^0.12.0", + "less-loader": "^7.0.2", + "mini-css-extract-plugin": "^1.0.0", "mockjs": "^1.1.0", "optimize-css-assets-webpack-plugin": "^5.0.4", - "postcss-loader": "^4.0.3", + "postcss": "^8.1.1", + "postcss-loader": "^4.0.4", "prettier": "2.1.2", - "style-loader": "1.3.0", + "style-loader": "2.0.0", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^4.2.3", - "url-loader": "^4.1.0", - "webpack": "^4.44.2", - "webpack-cli": "^3.3.12", + "terser-webpack-plugin": "^5.0.0", + "url-loader": "^4.1.1", + "webpack": "4.x", + "webpack-cli": "^4.0.0", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", diff --git a/postcss.config.js b/postcss.config.js index fe843fae..6ebf6265 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,6 +1,6 @@ /** postcss-loader 解析器所需的配置文件 **/ module.exports = { plugins: [ - require('autoprefixer')() + require('autoprefixer') ] }; diff --git a/src/container/routers/index.js b/src/container/routers/index.js index 3861dc20..6f17f0ec 100644 --- a/src/container/routers/index.js +++ b/src/container/routers/index.js @@ -11,6 +11,7 @@ import zhCN from "antd/lib/locale-provider/zh_CN"; // import {createBrowserHistory as createHistory} from "history/"; // URL模式的history import { createHashHistory as createHistory } from "history"; // 锚点模式的history + import Loadable from "react-loadable"; // 用于代码分割时动态加载模块 /** 普通组件 **/ diff --git a/webpack.dev.config.js b/webpack.dev.config.js index 4b8bfc96..b62cf886 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -16,7 +16,7 @@ module.exports = { output: { path: __dirname + "/", // 将打包好的文件放在此路径下,dev模式中,只会在内存中存在,不会真正的打包到此路径 publicPath: PUBLIC_PATH, // 文件解析路径,index.html中引用的路径会被设置为相对于此路径 - filename: "bundle.js", // 编译后的文件名字 + filename: "bundle-[hash].js", // 编译后的文件名字 }, devtool: "eval-source-map", // 报错的时候在控制台输出哪一行报错 optimization: { From 0035fcc2bfb68e13ed314ba6627001b9b8473b58 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 20 Oct 2020 02:12:11 +0800 Subject: [PATCH 34/98] update --- "\344\276\235\350\265\226\346\270\205\345\215\225.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/\344\276\235\350\265\226\346\270\205\345\215\225.md" "b/\344\276\235\350\265\226\346\270\205\345\215\225.md" index 3e56761b..2bcd5abf 100644 --- "a/\344\276\235\350\265\226\346\270\205\345\215\225.md" +++ "b/\344\276\235\350\265\226\346\270\205\345\215\225.md" @@ -5,7 +5,7 @@ ```javascript { "name": "react_luo", // 项目名字 - "version": "1.0.0", // 项目版本 + "version": "1.0.0", // 项目版本 "description": "react脚手架,最新技术", // 项目简介 "main": "index.js", // 项目入口,没用,因为配置了server.js "scripts": { // 自定义的脚本 From 50510209c1699e07fb120efa1cd6fee76f662009 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 20 Oct 2020 14:15:35 +0800 Subject: [PATCH 35/98] update package.json --- package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index bf33c247..fb1eb419 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.7.0", + "antd": "^4.7.2", "axios": "^0.20.0", "core-js": "^3.6.5", "history": "^4.10.1", @@ -37,7 +37,7 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "7.12.3", + "@babel/core": "^7.12.3", "@babel/plugin-proposal-class-properties": "^7.12.1", "@babel/plugin-proposal-decorators": "^7.12.1", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1", @@ -55,11 +55,11 @@ "babel-plugin-import": "^1.13.1", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "css-loader": "5.0.0", + "css-loader": "^5.0.0", "eslint": "^7.11.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", - "eslint-plugin-react": "^7.21.4", + "eslint-plugin-react": "^7.21.5", "eslint-plugin-react-hooks": "^4.1.2", "express": "^4.17.1", "favicons-webpack-plugin": "4.2.0", @@ -68,18 +68,18 @@ "html-webpack-plugin": "^4.5.0", "less": "^3.12.2", "less-loader": "^7.0.2", - "mini-css-extract-plugin": "^1.0.0", + "mini-css-extract-plugin": "^1.1.0", "mockjs": "^1.1.0", "optimize-css-assets-webpack-plugin": "^5.0.4", "postcss": "^8.1.1", "postcss-loader": "^4.0.4", - "prettier": "2.1.2", - "style-loader": "2.0.0", + "prettier": "^2.1.2", + "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.0.0", "url-loader": "^4.1.1", - "webpack": "4.x", - "webpack-cli": "^4.0.0", + "webpack": "^4.x", + "webpack-cli": "^4.1.0", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", From 9778c2498257d2223bd84dcf2484bad19e396443 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 20 Oct 2020 15:11:27 +0800 Subject: [PATCH 36/98] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 89c6ca38..b5127749 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ [![codebeat badge](https://codebeat.co/badges/eb91ca34-7c1b-424f-be1c-a5d79fd3d269)](https://codebeat.co/projects/github-com-javaluo-react-luo-master) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) ![GitHub last commit](https://img.shields.io/github/last-commit/javaLuo/react-luo.svg?style=popout) +## 注: antd和favicons-webpack-plugin目前还不支持webpack5,现在打包会失败 + ## what is this? react automatically
From f6b9a7d5ec9905daaf78d1a36054d57e170ccf95 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Wed, 21 Oct 2020 14:37:10 +0800 Subject: [PATCH 37/98] update webpack 5 / react 17 --- README.md | 2 +- package.json | 14 ++--- server.js | 8 +-- src/component/footer/index.js | 2 +- src/container/home/index.js | 2 +- webpack.dev.config.js | 2 +- webpack.production.config.js | 110 +++++++++++++++++----------------- 7 files changed, 70 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index b5127749..d7b39834 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![codebeat badge](https://codebeat.co/badges/eb91ca34-7c1b-424f-be1c-a5d79fd3d269)](https://codebeat.co/projects/github-com-javaluo-react-luo-master) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) ![GitHub last commit](https://img.shields.io/github/last-commit/javaLuo/react-luo.svg?style=popout) -## 注: antd和favicons-webpack-plugin目前还不支持webpack5,现在打包会失败 +## 注: favicons-webpack-plugin, sw-precache-webpack-plugin 目前还不支持webpack5, 所以暂时取消了PWA相关设置 ## what is this? diff --git a/package.json b/package.json index fb1eb419..719fa426 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "start": "node server.js --max_old_space_size=4096", - "build": "webpack -p --config webpack.production.config.js", + "build": "webpack --config webpack.production.config.js", "dist": "set NODE_ENV=production&& node server.js", "distmac": "export NODE_ENV=production&& node server.js", "prettier": "prettier --write \"{src,mock}/**/*.{js,css,less}\"", @@ -29,8 +29,8 @@ "core-js": "^3.6.5", "history": "^4.10.1", "lodash": "^4.17.20", - "react": "^16.14.0", - "react-dom": "^16.14.0", + "react": "^17.0.0", + "react-dom": "^17.0.0", "react-loadable": "^5.5.0", "react-redux": "^7.2.1", "react-router-dom": "^5.2.0", @@ -60,7 +60,7 @@ "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.21.5", - "eslint-plugin-react-hooks": "^4.1.2", + "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", "favicons-webpack-plugin": "4.2.0", "file-loader": "^6.1.1", @@ -68,17 +68,17 @@ "html-webpack-plugin": "^4.5.0", "less": "^3.12.2", "less-loader": "^7.0.2", - "mini-css-extract-plugin": "^1.1.0", + "mini-css-extract-plugin": "^1.1.1", "mockjs": "^1.1.0", "optimize-css-assets-webpack-plugin": "^5.0.4", - "postcss": "^8.1.1", + "postcss": "^8.1.2", "postcss-loader": "^4.0.4", "prettier": "^2.1.2", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.0.0", "url-loader": "^4.1.1", - "webpack": "^4.x", + "webpack": "^5.1.3", "webpack-cli": "^4.1.0", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", diff --git a/server.js b/server.js index 52ccb9ce..9ff59022 100644 --- a/server.js +++ b/server.js @@ -56,10 +56,10 @@ if (env === "production") { } /** 监听POST请求,返回MOCK模拟数据 **/ -// app.post("*", (req, res, next) => { -// const result = mock.mockApi(req.originalUrl, req.body); -// res.send(result); -// }); +app.post("*", (req, res, next) => { + const result = mock.mockApi(req.originalUrl, req.body); + res.send(result); +}); /** 启动服务 **/ app.listen(PORT, () => { diff --git a/src/component/footer/index.js b/src/component/footer/index.js index d1cd7345..6f2f6ccd 100644 --- a/src/component/footer/index.js +++ b/src/component/footer/index.js @@ -11,7 +11,7 @@ export default function Footer(props) { target="_blank" rel="noopener noreferrer" > - isluo.com + blog.isluo.com , Inc. diff --git a/src/container/home/index.js b/src/container/home/index.js index abda1a32..064648b5 100644 --- a/src/container/home/index.js +++ b/src/container/home/index.js @@ -15,7 +15,7 @@ function HomePageContainer(props) {
React-Luo
- react16、redux4、router5、webpack4、eslint、babel7、antd3 + react17、redux4、router5、webpack5、eslint、babel7、antd4
diff --git a/webpack.dev.config.js b/webpack.dev.config.js index b62cf886..d563fae7 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -16,7 +16,7 @@ module.exports = { output: { path: __dirname + "/", // 将打包好的文件放在此路径下,dev模式中,只会在内存中存在,不会真正的打包到此路径 publicPath: PUBLIC_PATH, // 文件解析路径,index.html中引用的路径会被设置为相对于此路径 - filename: "bundle-[hash].js", // 编译后的文件名字 + filename: "bundle-[contenthash].js", // 编译后的文件名字 }, devtool: "eval-source-map", // 报错的时候在控制台输出哪一行报错 optimization: { diff --git a/webpack.production.config.js b/webpack.production.config.js index f8060b09..9b7b5d0b 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -6,10 +6,10 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin"); // 为了单独 const HtmlWebpackPlugin = require("html-webpack-plugin"); // 生成html const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin"); const { CleanWebpackPlugin } = require("clean-webpack-plugin"); // 每次打包前清除旧的build文件夹 -const SWPrecacheWebpackPlugin = require("sw-precache-webpack-plugin"); // 生成一个server-worker用于缓存 -const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); // 自动生成各尺寸的favicon图标 +// const SWPrecacheWebpackPlugin = require("sw-precache-webpack-plugin"); // 生成一个server-worker用于缓存 webpack5 wating up +// const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); // 自动生成各尺寸的favicon图标 webpack5 wating up const TerserPlugin = require("terser-webpack-plugin"); // 优化js -const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin"); // 压缩CSS +// const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin"); // 压缩CSS const webpackbar = require("webpackbar"); // 进度条 /** * 基础路径 @@ -33,6 +33,7 @@ module.exports = { children: false, // 不输出子模块的打包信息 }, optimization: { + minimize: true, minimizer: [ new TerserPlugin({ parallel: true, // 多线程并行构建 @@ -45,7 +46,6 @@ module.exports = { }, }, }), - new OptimizeCSSAssetsPlugin({}), ], splitChunks: { chunks: "all", @@ -141,29 +141,29 @@ module.exports = { filename: "dist/[name].[chunkhash:8].css", // 生成的文件名 }), /** - * 生成一个server-work用于缓存资源(PWA) + * 生成一个server-work用于缓存资源(PWA) webpack5 wating up * */ - new SWPrecacheWebpackPlugin({ - dontCacheBustUrlsMatching: /\.\w{8}\./, - filename: "service-worker.js", - logger(message) { - if (message.indexOf("Total precache size is") === 0) { - return; - } - if (message.indexOf("Skipping static resource") === 0) { - return; - } - console.log(message); - }, - minify: true, // 压缩 - navigateFallback: PUBLIC_PATH, // 遇到不存在的URL时,跳转到主页 - navigateFallbackWhitelist: [/^(?!\/__).*/], // 忽略从/__开始的网址,参考 https://github.com/facebookincubator/create-react-app/issues/2237#issuecomment-302693219 - staticFileGlobsIgnorePatterns: [ - /\.map$/, - /asset-manifest\.json$/, - /\.cache$/, - ], // 不缓存sourcemaps,它们太大了 - }), + // new SWPrecacheWebpackPlugin({ + // dontCacheBustUrlsMatching: /\.\w{8}\./, + // filename: "service-worker.js", + // logger(message) { + // if (message.indexOf("Total precache size is") === 0) { + // return; + // } + // if (message.indexOf("Skipping static resource") === 0) { + // return; + // } + // console.log(message); + // }, + // minify: true, // 压缩 + // navigateFallback: PUBLIC_PATH, // 遇到不存在的URL时,跳转到主页 + // navigateFallbackWhitelist: [/^(?!\/__).*/], // 忽略从/__开始的网址,参考 https://github.com/facebookincubator/create-react-app/issues/2237#issuecomment-302693219 + // staticFileGlobsIgnorePatterns: [ + // /\.map$/, + // /asset-manifest\.json$/, + // /\.cache$/, + // ], // 不缓存sourcemaps,它们太大了 + // }), /** * 自动生成HTML,并注入各参数 * **/ @@ -174,39 +174,39 @@ module.exports = { inject: true, // 是否将js放在body的末尾 }), /** - * 自动生成各种类型的favicon图标 + * 自动生成各种类型的favicon图标 webpack5 wating up * 自动生成manifest.json文件 * 这么做是为了各种设备上的扩展功能,PWA桌面图标/应用启动图标等,主题等 * https://github.com/itgalaxy/favicons#usage * **/ - new FaviconsWebpackPlugin({ - logo: "./public/favicon.png", // 原始图片路径 - // prefix: "", // 自定义目录,把生成的文件存在此目录下 - favicons: { - appName: "ReactPWA", // 你的APP全称 - appShortName: "React", // 你的APP简称,手机某些地方会显示,比如切换多个APP时显示的标题 - appDescription: "ReactPWA Demo", // 你的APP简介 - background: "#222222", // APP启动页的背景色 - theme_color: "#222222", // APP的主题色 - appleStatusBarStyle: "black-translucent", // 苹果手机状态栏样式 - display: "standalone", // 是否显示搜索框,PWA就别显示了 - start_url: PUBLIC_PATH, // 起始页,‘.’会自动到主页,比'/'好,尤其是网站没有部署到根域名时 - logging: false, // 是否输出日志 - pixel_art: false, // 是否自动锐化一下图标,仅离线模式可用 - loadManifestWithCredentials: false, // 浏览器在获取manifest.json时默认不会代cookie。如果需要请设置true - icons: { - // 生成哪些平台需要的图标 - android: true, // 安卓 - appleIcon: false, // 苹果 - appleStartup: false, // 苹果启动页 - coast: false, // opera - favicons: true, // web小图标 - firefox: false, // 火狐 - windows: false, // windows8 桌面应用 - yandex: false, // Yandex浏览器 - }, - }, - }), + // new FaviconsWebpackPlugin({ + // logo: "./public/favicon.png", // 原始图片路径 + // // prefix: "", // 自定义目录,把生成的文件存在此目录下 + // favicons: { + // appName: "ReactPWA", // 你的APP全称 + // appShortName: "React", // 你的APP简称,手机某些地方会显示,比如切换多个APP时显示的标题 + // appDescription: "ReactPWA Demo", // 你的APP简介 + // background: "#222222", // APP启动页的背景色 + // theme_color: "#222222", // APP的主题色 + // appleStatusBarStyle: "black-translucent", // 苹果手机状态栏样式 + // display: "standalone", // 是否显示搜索框,PWA就别显示了 + // start_url: PUBLIC_PATH, // 起始页,‘.’会自动到主页,比'/'好,尤其是网站没有部署到根域名时 + // logging: false, // 是否输出日志 + // pixel_art: false, // 是否自动锐化一下图标,仅离线模式可用 + // loadManifestWithCredentials: false, // 浏览器在获取manifest.json时默认不会代cookie。如果需要请设置true + // icons: { + // // 生成哪些平台需要的图标 + // android: true, // 安卓 + // appleIcon: false, // 苹果 + // appleStartup: false, // 苹果启动页 + // coast: false, // opera + // favicons: true, // web小图标 + // firefox: false, // 火狐 + // windows: false, // windows8 桌面应用 + // yandex: false, // Yandex浏览器 + // }, + // }, + // }), ], resolve: { extensions: [".js", ".jsx", ".less", ".css", ".wasm"], // 后缀名自动补全 From c51771b6d6c182a7bfe99973ebe3c7ac24454fcc Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Wed, 21 Oct 2020 15:23:59 +0800 Subject: [PATCH 38/98] update use css-minimizer-webpack-plugin --- package.json | 2 +- webpack.dev.config.js | 1 + webpack.production.config.js | 14 +++++++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 719fa426..c4e4c698 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "css-loader": "^5.0.0", + "css-minimizer-webpack-plugin": "^1.1.5", "eslint": "^7.11.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", @@ -70,7 +71,6 @@ "less-loader": "^7.0.2", "mini-css-extract-plugin": "^1.1.1", "mockjs": "^1.1.0", - "optimize-css-assets-webpack-plugin": "^5.0.4", "postcss": "^8.1.2", "postcss-loader": "^4.0.4", "prettier": "^2.1.2", diff --git a/webpack.dev.config.js b/webpack.dev.config.js index d563fae7..130851ac 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -7,6 +7,7 @@ const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin"); const HappyPack = require("happypack"); // 多线程编译 const webpackbar = require("webpackbar"); const PUBLIC_PATH = "/"; // 基础路径 + module.exports = { mode: "development", entry: [ diff --git a/webpack.production.config.js b/webpack.production.config.js index 9b7b5d0b..6a2abd66 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -2,14 +2,14 @@ const path = require("path"); const webpack = require("webpack"); // webpack核心 -const MiniCssExtractPlugin = require("mini-css-extract-plugin"); // 为了单独打包css +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); // 将CSS提取出来,而不是和js混在一起 +const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); // 对CSS进行压缩 const HtmlWebpackPlugin = require("html-webpack-plugin"); // 生成html const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin"); const { CleanWebpackPlugin } = require("clean-webpack-plugin"); // 每次打包前清除旧的build文件夹 // const SWPrecacheWebpackPlugin = require("sw-precache-webpack-plugin"); // 生成一个server-worker用于缓存 webpack5 wating up // const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); // 自动生成各尺寸的favicon图标 webpack5 wating up -const TerserPlugin = require("terser-webpack-plugin"); // 优化js -// const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin"); // 压缩CSS +const TerserPlugin = require("terser-webpack-plugin"); // 对js进行压缩 const webpackbar = require("webpackbar"); // 进度条 /** * 基础路径 @@ -46,6 +46,7 @@ module.exports = { }, }, }), + new CssMinimizerPlugin(), ], splitChunks: { chunks: "all", @@ -62,7 +63,10 @@ module.exports = { { // .css 解析 test: /\.css$/, - use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader"], + use: [ + MiniCssExtractPlugin.loader, + "css-loader", "postcss-loader" + ], }, { // .less 解析 @@ -135,7 +139,7 @@ module.exports = { }), }), /** - * 提取CSS等样式生成单独的CSS文件 + * 提取CSS等样式生成单独的CSS文件,不然最终文件只有js; css全部包含在js中 * **/ new MiniCssExtractPlugin({ filename: "dist/[name].[chunkhash:8].css", // 生成的文件名 From 98d8f9aef101b605394e260491ee53bd410b3c5a Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Mon, 26 Oct 2020 08:39:41 +0800 Subject: [PATCH 39/98] update packages for webpack5 --- package.json | 20 ++++++++++---------- webpack.production.config.js | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index c4e4c698..9e64ab48 100644 --- a/package.json +++ b/package.json @@ -24,13 +24,13 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.7.2", - "axios": "^0.20.0", + "antd": "^4.7.3", + "axios": "^0.21.0", "core-js": "^3.6.5", "history": "^4.10.1", "lodash": "^4.17.20", - "react": "^17.0.0", - "react-dom": "^17.0.0", + "react": "^17.0.1", + "react-dom": "^17.0.1", "react-loadable": "^5.5.0", "react-redux": "^7.2.1", "react-router-dom": "^5.2.0", @@ -57,7 +57,7 @@ "clean-webpack-plugin": "^3.0.0", "css-loader": "^5.0.0", "css-minimizer-webpack-plugin": "^1.1.5", - "eslint": "^7.11.0", + "eslint": "^7.12.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.21.5", @@ -66,19 +66,19 @@ "favicons-webpack-plugin": "4.2.0", "file-loader": "^6.1.1", "happypack": "^5.0.1", - "html-webpack-plugin": "^4.5.0", + "html-webpack-plugin": "^5.0.0-alpha.7", "less": "^3.12.2", "less-loader": "^7.0.2", - "mini-css-extract-plugin": "^1.1.1", + "mini-css-extract-plugin": "^1.2.0", "mockjs": "^1.1.0", - "postcss": "^8.1.2", + "postcss": "^8.1.4", "postcss-loader": "^4.0.4", "prettier": "^2.1.2", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^5.0.0", + "terser-webpack-plugin": "^5.0.1", "url-loader": "^4.1.1", - "webpack": "^5.1.3", + "webpack": "^5.2.0", "webpack-cli": "^4.1.0", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", diff --git a/webpack.production.config.js b/webpack.production.config.js index 6a2abd66..074f13fa 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -29,7 +29,7 @@ module.exports = { chunkFilename: "dist/[name].[chunkhash:8].chunk.js", }, stats: { - warningsFilter: (warning) => /Conflicting order/gm.test(warning), // 不输出一些警告,多为因CSS引入顺序不同导致的警告 + children: false, // 不输出子模块的打包信息 }, optimization: { From 8df8a950aa5f1406138ebd9ac1daa92da158584e Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Mon, 26 Oct 2020 17:09:06 +0800 Subject: [PATCH 40/98] update --- package.json | 2 + public/index.html | 7 ++ src/index.js | 4 +- src/serviceWorker.js | 135 ----------------------------------- webpack.dev.config.js | 18 ++++- webpack.production.config.js | 69 +++++++++--------- 6 files changed, 58 insertions(+), 177 deletions(-) delete mode 100644 src/serviceWorker.js diff --git a/package.json b/package.json index 9e64ab48..3b308772 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "babel-plugin-import": "^1.13.1", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", + "copy-webpack-plugin": "^6.2.1", "css-loader": "^5.0.0", "css-minimizer-webpack-plugin": "^1.1.5", "eslint": "^7.12.0", @@ -83,6 +84,7 @@ "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", + "workbox-webpack-plugin": "^6.0.0-alpha.3", "xml-loader": "^1.2.1" }, "browserslist": [ diff --git a/public/index.html b/public/index.html index 99054e47..1ceeadf3 100644 --- a/public/index.html +++ b/public/index.html @@ -8,5 +8,12 @@
+ diff --git a/src/index.js b/src/index.js index a1f8c309..70df8851 100644 --- a/src/index.js +++ b/src/index.js @@ -4,7 +4,7 @@ import "regenerator-runtime/runtime"; import React from "react"; import ReactDOM from "react-dom"; -import * as serviceWorker from "./serviceWorker"; +// import * as serviceWorker from "./serviceWorker"; import Root from "./root"; /** 公共样式 **/ @@ -13,7 +13,7 @@ import "./styles/less.less"; ReactDOM.render(, document.getElementById("app-root")); -serviceWorker.register(); +// serviceWorker.register(); if (module.hot) { module.hot.accept(); diff --git a/src/serviceWorker.js b/src/serviceWorker.js deleted file mode 100644 index 1bf5b0fc..00000000 --- a/src/serviceWorker.js +++ /dev/null @@ -1,135 +0,0 @@ -// This optional code is used to register a service worker. -// register() is not called by default. - -// This lets the app load faster on subsequent visits in production, and gives -// it offline capabilities. However, it also means that developers (and users) -// will only see deployed updates on subsequent visits to a page, after all the -// existing tabs open on the page have been closed, since previously cached -// resources are updated in the background. - -// To learn more about the benefits of this model and instructions on how to -// opt-in, read http://bit.ly/CRA-PWA - -const isLocalhost = Boolean( - window.location.hostname === "localhost" || - // [::1] is the IPv6 localhost address. - window.location.hostname === "[::1]" || - // 127.0.0.1/8 is considered localhost for IPv4. - window.location.hostname.match( - /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ - ) -); - -export function register(config) { - if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) { - // The URL constructor is available in all browsers that support SW. - const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); - if (publicUrl.origin !== window.location.origin) { - // Our service worker won't work if PUBLIC_URL is on a different origin - // from what our page is served on. This might happen if a CDN is used to - // serve assets; see https://github.com/facebook/create-react-app/issues/2374 - return; - } - - window.addEventListener("load", () => { - const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; - - if (isLocalhost) { - // This is running on localhost. Let's check if a service worker still exists or not. - checkValidServiceWorker(swUrl, config); - - // Add some additional logging to localhost, pointing developers to the - // service worker/PWA documentation. - navigator.serviceWorker.ready.then(() => { - console.log( - "This web app is being served cache-first by a service " + - "worker. To learn more, visit http://bit.ly/CRA-PWA" - ); - }); - } else { - // Is not localhost. Just register service worker - registerValidSW(swUrl, config); - } - }); - } -} - -function registerValidSW(swUrl, config) { - navigator.serviceWorker - .register(swUrl) - .then((registration) => { - registration.onupdatefound = () => { - const installingWorker = registration.installing; - if (installingWorker == null) { - return; - } - installingWorker.onstatechange = () => { - if (installingWorker.state === "installed") { - if (navigator.serviceWorker.controller) { - // At this point, the updated precached content has been fetched, - // but the previous service worker will still serve the older - // content until all client tabs are closed. - console.log( - "New content is available and will be used when all " + - "tabs for this page are closed. See http://bit.ly/CRA-PWA." - ); - - // Execute callback - if (config && config.onUpdate) { - config.onUpdate(registration); - } - } else { - // At this point, everything has been precached. - // It's the perfect time to display a - // "Content is cached for offline use." message. - console.log("Content is cached for offline use."); - - // Execute callback - if (config && config.onSuccess) { - config.onSuccess(registration); - } - } - } - }; - }; - }) - .catch((error) => { - console.error("Error during service worker registration:", error); - }); -} - -function checkValidServiceWorker(swUrl, config) { - // Check if the service worker can be found. If it can't reload the page. - fetch(swUrl) - .then((response) => { - // Ensure service worker exists, and that we really are getting a JS file. - const contentType = response.headers.get("content-type"); - if ( - response.status === 404 || - (contentType != null && contentType.indexOf("javascript") === -1) - ) { - // No service worker found. Probably a different app. Reload the page. - navigator.serviceWorker.ready.then((registration) => { - registration.unregister().then(() => { - window.location.reload(); - }); - }); - } else { - // Service worker found. Proceed as normal. - registerValidSW(swUrl, config); - } - }) - .catch(() => { - console.log( - "No internet connection found. App is running in offline mode." - ); - }); -} - -export function unregister() { - if ("serviceWorker" in navigator) { - navigator.serviceWorker.ready.then((registration) => { - registration.unregister(); - }); - } -} diff --git a/webpack.dev.config.js b/webpack.dev.config.js index 130851ac..aa4ec5ed 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -4,6 +4,7 @@ const path = require("path"); // 获取绝对路径用 const webpack = require("webpack"); // webpack核心 const HtmlWebpackPlugin = require("html-webpack-plugin"); // 动态生成html插件 const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin"); +const CopyPlugin = require("copy-webpack-plugin"); // 用于直接复制public中的文件到打包的最终文件夹中 const HappyPack = require("happypack"); // 多线程编译 const webpackbar = require("webpackbar"); const PUBLIC_PATH = "/"; // 基础路径 @@ -104,9 +105,7 @@ module.exports = { new webpack.HotModuleReplacementPlugin(), // 热更新插件 new AntdDayjsWebpackPlugin(), // dayjs 替代 momentjs new webpack.DefinePlugin({ - "process.env": JSON.stringify({ - PUBLIC_URL: PUBLIC_PATH, - }), + "process.env": "dev", }), new HappyPack({ loaders: ["babel-loader"], @@ -118,6 +117,19 @@ module.exports = { template: "./public/index.html", //html模板路径 inject: true, // 是否将js放在body的末尾 }), + // 拷贝public中的文件到最终打包文件夹里 + new CopyPlugin({ + patterns: [ + { + from: "./public/**/*", + to: "./", + globOptions: { + ignore: ["**/favicon.png", "**/index.html"], + }, + noErrorOnMissing: true, + }, + ], + }), ], resolve: { extensions: [".js", ".jsx", ".less", ".css", ".wasm"], //后缀名自动补全 diff --git a/webpack.production.config.js b/webpack.production.config.js index 074f13fa..3a4c83bc 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -3,11 +3,12 @@ const path = require("path"); const webpack = require("webpack"); // webpack核心 const MiniCssExtractPlugin = require("mini-css-extract-plugin"); // 将CSS提取出来,而不是和js混在一起 -const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); // 对CSS进行压缩 +const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); // 对CSS进行压缩 const HtmlWebpackPlugin = require("html-webpack-plugin"); // 生成html const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin"); const { CleanWebpackPlugin } = require("clean-webpack-plugin"); // 每次打包前清除旧的build文件夹 -// const SWPrecacheWebpackPlugin = require("sw-precache-webpack-plugin"); // 生成一个server-worker用于缓存 webpack5 wating up +const WorkboxPlugin = require("workbox-webpack-plugin"); +const CopyPlugin = require("copy-webpack-plugin"); // 用于直接复制public中的文件到打包的最终文件夹中 // const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); // 自动生成各尺寸的favicon图标 webpack5 wating up const TerserPlugin = require("terser-webpack-plugin"); // 对js进行压缩 const webpackbar = require("webpackbar"); // 进度条 @@ -29,7 +30,6 @@ module.exports = { chunkFilename: "dist/[name].[chunkhash:8].chunk.js", }, stats: { - children: false, // 不输出子模块的打包信息 }, optimization: { @@ -63,10 +63,7 @@ module.exports = { { // .css 解析 test: /\.css$/, - use: [ - MiniCssExtractPlugin.loader, - "css-loader", "postcss-loader" - ], + use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader"], }, { // .less 解析 @@ -125,51 +122,27 @@ module.exports = { plugins: [ /** * 打包前删除上一次打包留下的旧代码(根据output.path) + * https://github.com/johnagan/clean-webpack-plugin * **/ new CleanWebpackPlugin(), - new webpackbar(), + new webpackbar(), // 打包时美化进度条 new AntdDayjsWebpackPlugin(), // dayjs 替代 momentjs /** - * 在window环境中注入全局变量 - * 这里这么做是因为src/registerServiceWorker.js中有用到,为了配置PWA + * 在window环境中注入全局变量,虽然暂时没用上,不过在真实开发中应该会用到 * **/ new webpack.DefinePlugin({ - "process.env": JSON.stringify({ - PUBLIC_URL: PUBLIC_PATH.replace(/\/$/, ""), - }), + "process.env": "prod", }), /** * 提取CSS等样式生成单独的CSS文件,不然最终文件只有js; css全部包含在js中 + * https://github.com/webpack-contrib/mini-css-extract-plugin * **/ new MiniCssExtractPlugin({ filename: "dist/[name].[chunkhash:8].css", // 生成的文件名 }), - /** - * 生成一个server-work用于缓存资源(PWA) webpack5 wating up - * */ - // new SWPrecacheWebpackPlugin({ - // dontCacheBustUrlsMatching: /\.\w{8}\./, - // filename: "service-worker.js", - // logger(message) { - // if (message.indexOf("Total precache size is") === 0) { - // return; - // } - // if (message.indexOf("Skipping static resource") === 0) { - // return; - // } - // console.log(message); - // }, - // minify: true, // 压缩 - // navigateFallback: PUBLIC_PATH, // 遇到不存在的URL时,跳转到主页 - // navigateFallbackWhitelist: [/^(?!\/__).*/], // 忽略从/__开始的网址,参考 https://github.com/facebookincubator/create-react-app/issues/2237#issuecomment-302693219 - // staticFileGlobsIgnorePatterns: [ - // /\.map$/, - // /asset-manifest\.json$/, - // /\.cache$/, - // ], // 不缓存sourcemaps,它们太大了 - // }), /** * 自动生成HTML,并注入各参数 + * https://github.com/jantimon/html-webpack-plugin * **/ new HtmlWebpackPlugin({ filename: "index.html", // 生成的html存放路径,相对于 output.path @@ -177,6 +150,22 @@ module.exports = { hash: false, // 防止缓存,在引入的文件后面加hash (PWA就是要缓存,这里设置为false) inject: true, // 是否将js放在body的末尾 }), + /** + * 拷贝public中的文件到最终打包文件夹里 + * https://github.com/webpack-contrib/copy-webpack-plugin + * */ + new CopyPlugin({ + patterns: [ + { + from: "./public/**/*", + to: "./", + globOptions: { + ignore: ["**/favicon.png", "**/index.html"], + }, + noErrorOnMissing: true, + }, + ], + }), /** * 自动生成各种类型的favicon图标 webpack5 wating up * 自动生成manifest.json文件 @@ -211,6 +200,12 @@ module.exports = { // }, // }, // }), + + /** + * PWA - 自动生成server-worker.js + * https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-webpack-plugin.GenerateSW?hl=en + * */ + new WorkboxPlugin.GenerateSW(), ], resolve: { extensions: [".js", ".jsx", ".less", ".css", ".wasm"], // 后缀名自动补全 From 381f29bf076cf336cc32f1aa0012458b1bff65ad Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Mon, 26 Oct 2020 17:10:36 +0800 Subject: [PATCH 41/98] update --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index d7b39834..5bbf89f4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![codebeat badge](https://codebeat.co/badges/eb91ca34-7c1b-424f-be1c-a5d79fd3d269)](https://codebeat.co/projects/github-com-javaluo-react-luo-master) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) ![GitHub last commit](https://img.shields.io/github/last-commit/javaLuo/react-luo.svg?style=popout) -## 注: favicons-webpack-plugin, sw-precache-webpack-plugin 目前还不支持webpack5, 所以暂时取消了PWA相关设置 +## 注: favicons-webpack-plugin 目前还不支持 webpack5, 所以暂时取消了 manifest 相关设置 ## what is this? @@ -15,7 +15,6 @@ react automatically
- PWA、Hooks、代码分割、热替换、HappyPack 多线程构建、ES6+语法 - ## 构建 Start ``` From 07f7dd85409ebe472ad2876dbf9b56500921e0ab Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 29 Oct 2020 13:12:32 +0800 Subject: [PATCH 42/98] update packages --- README.md | 2 -- package.json | 2 +- webpack.production.config.js | 58 ++++++++++++++++++------------------ 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 5bbf89f4..1e10fa11 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,6 @@ [![codebeat badge](https://codebeat.co/badges/eb91ca34-7c1b-424f-be1c-a5d79fd3d269)](https://codebeat.co/projects/github-com-javaluo-react-luo-master) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) ![GitHub last commit](https://img.shields.io/github/last-commit/javaLuo/react-luo.svg?style=popout) -## 注: favicons-webpack-plugin 目前还不支持 webpack5, 所以暂时取消了 manifest 相关设置 - ## what is this? react automatically
diff --git a/package.json b/package.json index 3b308772..9d4bea88 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "eslint-plugin-react": "^7.21.5", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", - "favicons-webpack-plugin": "4.2.0", + "favicons-webpack-plugin": "^5.0.0-alpha.1", "file-loader": "^6.1.1", "happypack": "^5.0.1", "html-webpack-plugin": "^5.0.0-alpha.7", diff --git a/webpack.production.config.js b/webpack.production.config.js index 3a4c83bc..8d2a27c0 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -9,7 +9,7 @@ const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin"); const { CleanWebpackPlugin } = require("clean-webpack-plugin"); // 每次打包前清除旧的build文件夹 const WorkboxPlugin = require("workbox-webpack-plugin"); const CopyPlugin = require("copy-webpack-plugin"); // 用于直接复制public中的文件到打包的最终文件夹中 -// const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); // 自动生成各尺寸的favicon图标 webpack5 wating up +const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); // 自动生成各尺寸的favicon图标 webpack5 wating up const TerserPlugin = require("terser-webpack-plugin"); // 对js进行压缩 const webpackbar = require("webpackbar"); // 进度条 /** @@ -172,34 +172,34 @@ module.exports = { * 这么做是为了各种设备上的扩展功能,PWA桌面图标/应用启动图标等,主题等 * https://github.com/itgalaxy/favicons#usage * **/ - // new FaviconsWebpackPlugin({ - // logo: "./public/favicon.png", // 原始图片路径 - // // prefix: "", // 自定义目录,把生成的文件存在此目录下 - // favicons: { - // appName: "ReactPWA", // 你的APP全称 - // appShortName: "React", // 你的APP简称,手机某些地方会显示,比如切换多个APP时显示的标题 - // appDescription: "ReactPWA Demo", // 你的APP简介 - // background: "#222222", // APP启动页的背景色 - // theme_color: "#222222", // APP的主题色 - // appleStatusBarStyle: "black-translucent", // 苹果手机状态栏样式 - // display: "standalone", // 是否显示搜索框,PWA就别显示了 - // start_url: PUBLIC_PATH, // 起始页,‘.’会自动到主页,比'/'好,尤其是网站没有部署到根域名时 - // logging: false, // 是否输出日志 - // pixel_art: false, // 是否自动锐化一下图标,仅离线模式可用 - // loadManifestWithCredentials: false, // 浏览器在获取manifest.json时默认不会代cookie。如果需要请设置true - // icons: { - // // 生成哪些平台需要的图标 - // android: true, // 安卓 - // appleIcon: false, // 苹果 - // appleStartup: false, // 苹果启动页 - // coast: false, // opera - // favicons: true, // web小图标 - // firefox: false, // 火狐 - // windows: false, // windows8 桌面应用 - // yandex: false, // Yandex浏览器 - // }, - // }, - // }), + new FaviconsWebpackPlugin({ + logo: "./public/favicon.png", // 原始图片路径 + // prefix: "", // 自定义目录,把生成的文件存在此目录下 + favicons: { + appName: "ReactPWA", // 你的APP全称 + appShortName: "React", // 你的APP简称,手机某些地方会显示,比如切换多个APP时显示的标题 + appDescription: "ReactPWA Demo", // 你的APP简介 + background: "#222222", // APP启动页的背景色 + theme_color: "#222222", // APP的主题色 + appleStatusBarStyle: "black-translucent", // 苹果手机状态栏样式 + display: "standalone", // 是否显示搜索框,PWA就别显示了 + start_url: PUBLIC_PATH, // 起始页,‘.’会自动到主页,比'/'好,尤其是网站没有部署到根域名时 + logging: false, // 是否输出日志 + pixel_art: false, // 是否自动锐化一下图标,仅离线模式可用 + loadManifestWithCredentials: false, // 浏览器在获取manifest.json时默认不会代cookie。如果需要请设置true + icons: { + // 生成哪些平台需要的图标 + android: true, // 安卓 + appleIcon: false, // 苹果 + appleStartup: false, // 苹果启动页 + coast: false, // opera + favicons: true, // web小图标 + firefox: false, // 火狐 + windows: false, // windows8 桌面应用 + yandex: false, // Yandex浏览器 + }, + }, + }), /** * PWA - 自动生成server-worker.js From 3f66fc1083b656d47ebf0d9378b93a9036a15a81 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Wed, 4 Nov 2020 17:00:30 +0800 Subject: [PATCH 43/98] update packages --- package.json | 22 +++++++++++----------- server.js | 14 +++++++------- src/container/home/index.js | 10 ++++------ src/index.js | 5 +---- 4 files changed, 23 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index 9d4bea88..1c460d74 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.7.3", + "antd": "^4.8.0", "axios": "^0.21.0", "core-js": "^3.6.5", "history": "^4.10.1", @@ -32,7 +32,7 @@ "react": "^17.0.1", "react-dom": "^17.0.1", "react-loadable": "^5.5.0", - "react-redux": "^7.2.1", + "react-redux": "^7.2.2", "react-router-dom": "^5.2.0", "redux": "^4.0.5" }, @@ -46,8 +46,8 @@ "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-runtime": "^7.12.1", "@babel/preset-env": "^7.12.1", - "@babel/preset-react": "^7.12.1", - "@babel/runtime": "^7.12.1", + "@babel/preset-react": "^7.12.5", + "@babel/runtime": "^7.12.5", "antd-dayjs-webpack-plugin": "^1.0.1", "autoprefixer": "^10.0.1", "babel-eslint": "^10.1.0", @@ -55,33 +55,33 @@ "babel-plugin-import": "^1.13.1", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "copy-webpack-plugin": "^6.2.1", + "copy-webpack-plugin": "^6.3.0", "css-loader": "^5.0.0", "css-minimizer-webpack-plugin": "^1.1.5", - "eslint": "^7.12.0", + "eslint": "^7.12.1", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.21.5", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", "favicons-webpack-plugin": "^5.0.0-alpha.1", - "file-loader": "^6.1.1", + "file-loader": "^6.2.0", "happypack": "^5.0.1", "html-webpack-plugin": "^5.0.0-alpha.7", "less": "^3.12.2", "less-loader": "^7.0.2", - "mini-css-extract-plugin": "^1.2.0", + "mini-css-extract-plugin": "^1.2.1", "mockjs": "^1.1.0", "postcss": "^8.1.4", "postcss-loader": "^4.0.4", "prettier": "^2.1.2", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^5.0.1", + "terser-webpack-plugin": "^5.0.3", "url-loader": "^4.1.1", - "webpack": "^5.2.0", + "webpack": "^5.4.0", "webpack-cli": "^4.1.0", - "webpack-dev-middleware": "^3.7.2", + "webpack-dev-middleware": "^4.0.0", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", "workbox-webpack-plugin": "^6.0.0-alpha.3", diff --git a/server.js b/server.js index 9ff59022..55218693 100644 --- a/server.js +++ b/server.js @@ -20,7 +20,7 @@ app.use(bodyParser.json()); if (env === "production") { // 如果是生产环境,则运行build文件夹中的代码 app.use(express.static("build")); - app.get("*", function(req, res) { + app.get("*", function (req, res) { res.sendFile(path.join(__dirname, "build", "index.html")); }); } else { @@ -30,12 +30,12 @@ if (env === "production") { webpackDevMiddleware(compiler, { // 挂载webpack小型服务器 publicPath: webpackConfig.output.publicPath, // 对应webpack配置中的publicPath - quiet: true, // 是否不输出启动时的相关信息 - stats: { - colors: true, // 不同信息不同颜色 - timings: true // 输出各步骤消耗的时间 - } - }) + // quiet: true, // 是否不输出启动时的相关信息 + // stats: { + // colors: true, // 不同信息不同颜色 + // timings: true // 输出各步骤消耗的时间 + // } + }), ); // 挂载HMR热更新中间件 app.use(webpackHotMiddleware(compiler)); diff --git a/src/container/home/index.js b/src/container/home/index.js index 064648b5..e58baf75 100644 --- a/src/container/home/index.js +++ b/src/container/home/index.js @@ -14,19 +14,17 @@ function HomePageContainer(props) {
React-Luo
-
- react17、redux4、router5、webpack5、eslint、babel7、antd4 -
+
react17、redux4、router5、webpack5、eslint、babel7、antd4
); } export default connect( - (state) => { + state => { return {}; }, - (dispatch) => ({ + dispatch => ({ actions: {}, - }) + }), )(HomePageContainer); diff --git a/src/index.js b/src/index.js index 70df8851..1aa3f4a7 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,9 @@ /** APP入口 **/ import "core-js/stable"; import "regenerator-runtime/runtime"; + import React from "react"; import ReactDOM from "react-dom"; - -// import * as serviceWorker from "./serviceWorker"; import Root from "./root"; /** 公共样式 **/ @@ -13,8 +12,6 @@ import "./styles/less.less"; ReactDOM.render(, document.getElementById("app-root")); -// serviceWorker.register(); - if (module.hot) { module.hot.accept(); } From 98f2d040124ac214dad896841f6760ef308fa621 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 10 Nov 2020 17:33:23 +0800 Subject: [PATCH 44/98] update package --- package.json | 16 ++++++++-------- src/container/home/index.js | 10 ++++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 1c460d74..2eb5d786 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.8.0", + "antd": "^4.8.2", "axios": "^0.21.0", - "core-js": "^3.6.5", + "core-js": "^3.7.0", "history": "^4.10.1", "lodash": "^4.17.20", "react": "^17.0.1", @@ -56,9 +56,9 @@ "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^6.3.0", - "css-loader": "^5.0.0", + "css-loader": "^5.0.1", "css-minimizer-webpack-plugin": "^1.1.5", - "eslint": "^7.12.1", + "eslint": "^7.13.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.21.5", @@ -70,9 +70,9 @@ "html-webpack-plugin": "^5.0.0-alpha.7", "less": "^3.12.2", "less-loader": "^7.0.2", - "mini-css-extract-plugin": "^1.2.1", + "mini-css-extract-plugin": "^1.3.0", "mockjs": "^1.1.0", - "postcss": "^8.1.4", + "postcss": "^8.1.6", "postcss-loader": "^4.0.4", "prettier": "^2.1.2", "style-loader": "^2.0.0", @@ -80,8 +80,8 @@ "terser-webpack-plugin": "^5.0.3", "url-loader": "^4.1.1", "webpack": "^5.4.0", - "webpack-cli": "^4.1.0", - "webpack-dev-middleware": "^4.0.0", + "webpack-cli": "^4.2.0", + "webpack-dev-middleware": "^4.0.1", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", "workbox-webpack-plugin": "^6.0.0-alpha.3", diff --git a/src/container/home/index.js b/src/container/home/index.js index e58baf75..064648b5 100644 --- a/src/container/home/index.js +++ b/src/container/home/index.js @@ -14,17 +14,19 @@ function HomePageContainer(props) {
React-Luo
-
react17、redux4、router5、webpack5、eslint、babel7、antd4
+
+ react17、redux4、router5、webpack5、eslint、babel7、antd4 +
); } export default connect( - state => { + (state) => { return {}; }, - dispatch => ({ + (dispatch) => ({ actions: {}, - }), + }) )(HomePageContainer); From 283413983112a44ca60b431e7144a4592445e2b4 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 19 Nov 2020 14:55:42 +0800 Subject: [PATCH 45/98] =?UTF-8?q?update=EF=BC=9A=E4=BB=85=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E7=8E=AF=E5=A2=83=E6=9C=89PWA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 ++++------------- package.json | 18 +++++++++--------- public/index.html | 8 +------- server.js | 9 ++------- webpack.production.config.js | 11 ++++++++++- 5 files changed, 26 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 1e10fa11..3bfea5b4 100644 --- a/README.md +++ b/README.md @@ -17,23 +17,14 @@ react automatically
``` yarn install # 安装依赖模块 -``` - -``` -yarn start # 运行开发环境,默认监听8888端口 -``` -``` +yarn start # 运行开发环境: http://localhost:8888 yarn build # 正式打包,用于生产环境 -``` -``` -yarn prettier # 自动格式化src、mock目录下的所有.js/.css/.scss/.less文件 -``` +yarn dist # 运行正式打包后的最终文件(build目录下的文件): http://localhost:8889 +yarn distmac # MAC下运行最终文件:http://localhost:8889 -``` -yarn dist # 运行正式打包后的最终文件(build目录下的文件),默认监听8888端口 -yarn distmac # MAC下运行最终文件 +yarn prettier # 自动格式化src、mock目录下的所有.js/.css/.scss/.less文件 ``` ## 更新日志 Update log diff --git a/package.json b/package.json index 2eb5d786..ba5ec772 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.8.2", + "antd": "^4.8.4", "axios": "^0.21.0", "core-js": "^3.7.0", "history": "^4.10.1", @@ -49,13 +49,13 @@ "@babel/preset-react": "^7.12.5", "@babel/runtime": "^7.12.5", "antd-dayjs-webpack-plugin": "^1.0.1", - "autoprefixer": "^10.0.1", + "autoprefixer": "^10.0.2", "babel-eslint": "^10.1.0", - "babel-loader": "^8.1.0", + "babel-loader": "^8.2.1", "babel-plugin-import": "^1.13.1", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "copy-webpack-plugin": "^6.3.0", + "copy-webpack-plugin": "^6.3.1", "css-loader": "^5.0.1", "css-minimizer-webpack-plugin": "^1.1.5", "eslint": "^7.13.0", @@ -69,19 +69,19 @@ "happypack": "^5.0.1", "html-webpack-plugin": "^5.0.0-alpha.7", "less": "^3.12.2", - "less-loader": "^7.0.2", - "mini-css-extract-plugin": "^1.3.0", + "less-loader": "^7.1.0", + "mini-css-extract-plugin": "^1.3.1", "mockjs": "^1.1.0", - "postcss": "^8.1.6", + "postcss": "^8.1.7", "postcss-loader": "^4.0.4", "prettier": "^2.1.2", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.0.3", "url-loader": "^4.1.1", - "webpack": "^5.4.0", + "webpack": "^5.5.1", "webpack-cli": "^4.2.0", - "webpack-dev-middleware": "^4.0.1", + "webpack-dev-middleware": "^4.0.2", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", "workbox-webpack-plugin": "^6.0.0-alpha.3", diff --git a/public/index.html b/public/index.html index 1ceeadf3..1d7b6e3c 100644 --- a/public/index.html +++ b/public/index.html @@ -8,12 +8,6 @@
- + <%= htmlWebpackPlugin.options.registerServiceWorker %> diff --git a/server.js b/server.js index 55218693..2e5ddc99 100644 --- a/server.js +++ b/server.js @@ -12,13 +12,14 @@ const mock = require("./mock/mock-data"); // mock模拟数据,模拟后台业 const app = express(); // 实例化express服务 const DIST_DIR = webpackConfig.output.path; // webpack配置中设置的文件输出路径,所有文件存放在内存中 -const PORT = 8888; // 服务启动端口号 +let PORT = 8888; // 服务启动端口号 app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); if (env === "production") { // 如果是生产环境,则运行build文件夹中的代码 + PORT = 8889; app.use(express.static("build")); app.get("*", function (req, res) { res.sendFile(path.join(__dirname, "build", "index.html")); @@ -28,13 +29,7 @@ if (env === "production") { app.use(express.static("dll")); app.use( webpackDevMiddleware(compiler, { - // 挂载webpack小型服务器 publicPath: webpackConfig.output.publicPath, // 对应webpack配置中的publicPath - // quiet: true, // 是否不输出启动时的相关信息 - // stats: { - // colors: true, // 不同信息不同颜色 - // timings: true // 输出各步骤消耗的时间 - // } }), ); // 挂载HMR热更新中间件 diff --git a/webpack.production.config.js b/webpack.production.config.js index 8d2a27c0..c4a98709 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -41,8 +41,9 @@ module.exports = { // https://github.com/terser/terser#minify-options compress: { warnings: false, // 删除无用代码时是否给出警告 - drop_console: true, // 删除所有的console.* drop_debugger: true, // 删除所有的debugger + // drop_console: true, // 删除所有的console.* + pure_funcs: ["console.log"], // 删除所有的console.log }, }, }), @@ -149,6 +150,14 @@ module.exports = { template: "./public/index.html", // html模板路径 hash: false, // 防止缓存,在引入的文件后面加hash (PWA就是要缓存,这里设置为false) inject: true, // 是否将js放在body的末尾 + // 正式环境,把注册service-worker的代码加入到index.html中 + registerServiceWorker: ``, }), /** * 拷贝public中的文件到最终打包文件夹里 From ad0c8400241400c2778f2aa8aaa37261930475df Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 19 Nov 2020 15:41:16 +0800 Subject: [PATCH 46/98] update path --- webpack.production.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webpack.production.config.js b/webpack.production.config.js index c4a98709..50621849 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -16,7 +16,7 @@ const webpackbar = require("webpackbar"); // 进度条 * 基础路径 * 比如我上传到自己的服务器填写的是:"/work/pwa/",最终访问为"https://isluo.com/work/pwa/" * 根据你自己的需求填写 - * "/" 就是根路径,假如最终项目上线的地址为:https://isluo.com/, 那就可以直接写"/" + * "/" 就是根路径,假如最终项目上线的地址为:https://isluo.com/, 那就不用改 * **/ const PUBLIC_PATH = "/"; @@ -154,7 +154,7 @@ module.exports = { registerServiceWorker: ``, From de1d08c0449cb36e4bbcb218c2aef0a6239639f2 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 24 Nov 2020 13:58:23 +0800 Subject: [PATCH 47/98] update packages --- package.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index ba5ec772..bb4e947a 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.8.4", + "antd": "^4.8.5", "axios": "^0.21.0", "core-js": "^3.7.0", "history": "^4.10.1", @@ -37,16 +37,16 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.12.3", + "@babel/core": "^7.12.8", "@babel/plugin-proposal-class-properties": "^7.12.1", "@babel/plugin-proposal-decorators": "^7.12.1", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1", "@babel/plugin-proposal-object-rest-spread": "^7.12.1", - "@babel/plugin-proposal-optional-chaining": "^7.12.1", + "@babel/plugin-proposal-optional-chaining": "^7.12.7", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-runtime": "^7.12.1", - "@babel/preset-env": "^7.12.1", - "@babel/preset-react": "^7.12.5", + "@babel/preset-env": "^7.12.7", + "@babel/preset-react": "^7.12.7", "@babel/runtime": "^7.12.5", "antd-dayjs-webpack-plugin": "^1.0.1", "autoprefixer": "^10.0.2", @@ -55,10 +55,10 @@ "babel-plugin-import": "^1.13.1", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "copy-webpack-plugin": "^6.3.1", + "copy-webpack-plugin": "^6.3.2", "css-loader": "^5.0.1", "css-minimizer-webpack-plugin": "^1.1.5", - "eslint": "^7.13.0", + "eslint": "^7.14.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.21.5", @@ -72,14 +72,14 @@ "less-loader": "^7.1.0", "mini-css-extract-plugin": "^1.3.1", "mockjs": "^1.1.0", - "postcss": "^8.1.7", - "postcss-loader": "^4.0.4", - "prettier": "^2.1.2", + "postcss": "^8.1.10", + "postcss-loader": "^4.1.0", + "prettier": "^2.2.0", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.0.3", "url-loader": "^4.1.1", - "webpack": "^5.5.1", + "webpack": "^5.6.0", "webpack-cli": "^4.2.0", "webpack-dev-middleware": "^4.0.2", "webpack-hot-middleware": "^2.25.0", From af8c55da12267211b0f8afeb05bb0ae8ba89b480 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 26 Nov 2020 18:42:45 +0800 Subject: [PATCH 48/98] update --- webpack.production.config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webpack.production.config.js b/webpack.production.config.js index 50621849..e2aa77ae 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -214,7 +214,9 @@ module.exports = { * PWA - 自动生成server-worker.js * https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-webpack-plugin.GenerateSW?hl=en * */ - new WorkboxPlugin.GenerateSW(), + new WorkboxPlugin.GenerateSW({ + skipWaiting: true, // service-worker如果有更新的话,跳过等待直接更新 + }), ], resolve: { extensions: [".js", ".jsx", ".less", ".css", ".wasm"], // 后缀名自动补全 From f0a3115fa5059a92aeda3da4c42b1981eaf51a03 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Mon, 30 Nov 2020 16:48:23 +0800 Subject: [PATCH 49/98] update packages --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index bb4e947a..0f3b4758 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.8.5", + "antd": "^4.8.6", "axios": "^0.21.0", - "core-js": "^3.7.0", + "core-js": "^3.8.0", "history": "^4.10.1", "lodash": "^4.17.20", "react": "^17.0.1", @@ -37,7 +37,7 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.12.8", + "@babel/core": "^7.12.9", "@babel/plugin-proposal-class-properties": "^7.12.1", "@babel/plugin-proposal-decorators": "^7.12.1", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1", @@ -49,10 +49,10 @@ "@babel/preset-react": "^7.12.7", "@babel/runtime": "^7.12.5", "antd-dayjs-webpack-plugin": "^1.0.1", - "autoprefixer": "^10.0.2", + "autoprefixer": "^10.0.4", "babel-eslint": "^10.1.0", - "babel-loader": "^8.2.1", - "babel-plugin-import": "^1.13.1", + "babel-loader": "^8.2.2", + "babel-plugin-import": "^1.13.3", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^6.3.2", @@ -74,12 +74,12 @@ "mockjs": "^1.1.0", "postcss": "^8.1.10", "postcss-loader": "^4.1.0", - "prettier": "^2.2.0", + "prettier": "^2.2.1", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.0.3", "url-loader": "^4.1.1", - "webpack": "^5.6.0", + "webpack": "^5.9.0", "webpack-cli": "^4.2.0", "webpack-dev-middleware": "^4.0.2", "webpack-hot-middleware": "^2.25.0", From a9421ef4c30b56043cebfb63b4181a4bebb4236d Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 10 Dec 2020 15:39:46 +0800 Subject: [PATCH 50/98] update packages --- package.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 0f3b4758..b803ba30 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.8.6", + "antd": "^4.9.2", "axios": "^0.21.0", - "core-js": "^3.8.0", + "core-js": "^3.8.1", "history": "^4.10.1", "lodash": "^4.17.20", "react": "^17.0.1", @@ -37,30 +37,30 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.12.9", + "@babel/core": "^7.12.10", "@babel/plugin-proposal-class-properties": "^7.12.1", "@babel/plugin-proposal-decorators": "^7.12.1", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1", "@babel/plugin-proposal-object-rest-spread": "^7.12.1", "@babel/plugin-proposal-optional-chaining": "^7.12.7", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.12.1", - "@babel/preset-env": "^7.12.7", - "@babel/preset-react": "^7.12.7", + "@babel/plugin-transform-runtime": "^7.12.10", + "@babel/preset-env": "^7.12.10", + "@babel/preset-react": "^7.12.10", "@babel/runtime": "^7.12.5", "antd-dayjs-webpack-plugin": "^1.0.1", - "autoprefixer": "^10.0.4", + "autoprefixer": "^10.1.0", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "babel-plugin-import": "^1.13.3", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "copy-webpack-plugin": "^6.3.2", + "copy-webpack-plugin": "^6.4.0", "css-loader": "^5.0.1", "css-minimizer-webpack-plugin": "^1.1.5", - "eslint": "^7.14.0", + "eslint": "^7.15.0", "eslint-loader": "^4.0.2", - "eslint-plugin-prettier": "^3.1.4", + "eslint-plugin-prettier": "^3.2.0", "eslint-plugin-react": "^7.21.5", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", @@ -70,21 +70,21 @@ "html-webpack-plugin": "^5.0.0-alpha.7", "less": "^3.12.2", "less-loader": "^7.1.0", - "mini-css-extract-plugin": "^1.3.1", + "mini-css-extract-plugin": "^1.3.2", "mockjs": "^1.1.0", - "postcss": "^8.1.10", + "postcss": "^8.2.1", "postcss-loader": "^4.1.0", "prettier": "^2.2.1", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.0.3", "url-loader": "^4.1.1", - "webpack": "^5.9.0", + "webpack": "^5.10.0", "webpack-cli": "^4.2.0", "webpack-dev-middleware": "^4.0.2", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", - "workbox-webpack-plugin": "^6.0.0-alpha.3", + "workbox-webpack-plugin": "^6.0.2", "xml-loader": "^1.2.1" }, "browserslist": [ From 8b705bf24e61c558a22714349b7a8fd197a04f7b Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Mon, 14 Dec 2020 16:38:46 +0800 Subject: [PATCH 51/98] update packages --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index b803ba30..b8c09b9d 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.9.2", + "antd": "^4.9.3", "axios": "^0.21.0", "core-js": "^3.8.1", "history": "^4.10.1", @@ -55,12 +55,12 @@ "babel-plugin-import": "^1.13.3", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "copy-webpack-plugin": "^6.4.0", + "copy-webpack-plugin": "^7.0.0", "css-loader": "^5.0.1", "css-minimizer-webpack-plugin": "^1.1.5", "eslint": "^7.15.0", "eslint-loader": "^4.0.2", - "eslint-plugin-prettier": "^3.2.0", + "eslint-plugin-prettier": "^3.3.0", "eslint-plugin-react": "^7.21.5", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", @@ -68,9 +68,9 @@ "file-loader": "^6.2.0", "happypack": "^5.0.1", "html-webpack-plugin": "^5.0.0-alpha.7", - "less": "^3.12.2", + "less": "^3.13.0", "less-loader": "^7.1.0", - "mini-css-extract-plugin": "^1.3.2", + "mini-css-extract-plugin": "^1.3.3", "mockjs": "^1.1.0", "postcss": "^8.2.1", "postcss-loader": "^4.1.0", @@ -79,7 +79,7 @@ "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.0.3", "url-loader": "^4.1.1", - "webpack": "^5.10.0", + "webpack": "^5.10.1", "webpack-cli": "^4.2.0", "webpack-dev-middleware": "^4.0.2", "webpack-hot-middleware": "^2.25.0", From 16d72d881edcdf7eea50cdae7ebffe8210da6aea Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Mon, 28 Dec 2020 14:04:15 +0800 Subject: [PATCH 52/98] update --- package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index b8c09b9d..64ff9882 100644 --- a/package.json +++ b/package.json @@ -24,10 +24,11 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.9.3", - "axios": "^0.21.0", + "antd": "^4.9.4", + "axios": "^0.21.1", "core-js": "^3.8.1", "history": "^4.10.1", + "less": "^3.13.1", "lodash": "^4.17.20", "react": "^17.0.1", "react-dom": "^17.0.1", @@ -39,13 +40,13 @@ "devDependencies": { "@babel/core": "^7.12.10", "@babel/plugin-proposal-class-properties": "^7.12.1", - "@babel/plugin-proposal-decorators": "^7.12.1", + "@babel/plugin-proposal-decorators": "^7.12.12", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1", "@babel/plugin-proposal-object-rest-spread": "^7.12.1", "@babel/plugin-proposal-optional-chaining": "^7.12.7", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-runtime": "^7.12.10", - "@babel/preset-env": "^7.12.10", + "@babel/preset-env": "^7.12.11", "@babel/preset-react": "^7.12.10", "@babel/runtime": "^7.12.5", "antd-dayjs-webpack-plugin": "^1.0.1", @@ -58,7 +59,7 @@ "copy-webpack-plugin": "^7.0.0", "css-loader": "^5.0.1", "css-minimizer-webpack-plugin": "^1.1.5", - "eslint": "^7.15.0", + "eslint": "^7.16.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.3.0", "eslint-plugin-react": "^7.21.5", @@ -68,8 +69,7 @@ "file-loader": "^6.2.0", "happypack": "^5.0.1", "html-webpack-plugin": "^5.0.0-alpha.7", - "less": "^3.13.0", - "less-loader": "^7.1.0", + "less-loader": "^7.2.0", "mini-css-extract-plugin": "^1.3.3", "mockjs": "^1.1.0", "postcss": "^8.2.1", @@ -79,8 +79,8 @@ "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.0.3", "url-loader": "^4.1.1", - "webpack": "^5.10.1", - "webpack-cli": "^4.2.0", + "webpack": "^5.11.0", + "webpack-cli": "^4.3.0", "webpack-dev-middleware": "^4.0.2", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", From 1234bb4154ba7f751e1c401dbd11fc080de98f17 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 7 Jan 2021 11:04:04 +0800 Subject: [PATCH 53/98] update packages --- package.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 64ff9882..a95cdfc7 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,11 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.9.4", + "antd": "^4.10.0", "axios": "^0.21.1", - "core-js": "^3.8.1", + "core-js": "^3.8.2", "history": "^4.10.1", - "less": "^3.13.1", + "less": "^4.0.0", "lodash": "^4.17.20", "react": "^17.0.1", "react-dom": "^17.0.1", @@ -49,8 +49,8 @@ "@babel/preset-env": "^7.12.11", "@babel/preset-react": "^7.12.10", "@babel/runtime": "^7.12.5", - "antd-dayjs-webpack-plugin": "^1.0.1", - "autoprefixer": "^10.1.0", + "antd-dayjs-webpack-plugin": "^1.0.4", + "autoprefixer": "^10.2.0", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "babel-plugin-import": "^1.13.3", @@ -59,28 +59,28 @@ "copy-webpack-plugin": "^7.0.0", "css-loader": "^5.0.1", "css-minimizer-webpack-plugin": "^1.1.5", - "eslint": "^7.16.0", + "eslint": "^7.17.0", "eslint-loader": "^4.0.2", - "eslint-plugin-prettier": "^3.3.0", - "eslint-plugin-react": "^7.21.5", + "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", "favicons-webpack-plugin": "^5.0.0-alpha.1", "file-loader": "^6.2.0", "happypack": "^5.0.1", "html-webpack-plugin": "^5.0.0-alpha.7", - "less-loader": "^7.2.0", + "less-loader": "^7.2.1", "mini-css-extract-plugin": "^1.3.3", "mockjs": "^1.1.0", - "postcss": "^8.2.1", + "postcss": "^8.2.2", "postcss-loader": "^4.1.0", "prettier": "^2.2.1", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.0.3", "url-loader": "^4.1.1", - "webpack": "^5.11.0", - "webpack-cli": "^4.3.0", + "webpack": "^5.11.1", + "webpack-cli": "^4.3.1", "webpack-dev-middleware": "^4.0.2", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", From e5731c42c8a2ae166e82c2814ed6292dd25a191e Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 12 Jan 2021 14:33:39 +0800 Subject: [PATCH 54/98] update --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index a95cdfc7..865789ee 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,11 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.10.0", + "antd": "^4.10.2", "axios": "^0.21.1", "core-js": "^3.8.2", "history": "^4.10.1", - "less": "^4.0.0", + "less": "^4.1.0", "lodash": "^4.17.20", "react": "^17.0.1", "react-dom": "^17.0.1", @@ -50,7 +50,7 @@ "@babel/preset-react": "^7.12.10", "@babel/runtime": "^7.12.5", "antd-dayjs-webpack-plugin": "^1.0.4", - "autoprefixer": "^10.2.0", + "autoprefixer": "^10.2.1", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "babel-plugin-import": "^1.13.3", @@ -58,7 +58,7 @@ "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^7.0.0", "css-loader": "^5.0.1", - "css-minimizer-webpack-plugin": "^1.1.5", + "css-minimizer-webpack-plugin": "^1.2.0", "eslint": "^7.17.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.3.1", @@ -72,14 +72,14 @@ "less-loader": "^7.2.1", "mini-css-extract-plugin": "^1.3.3", "mockjs": "^1.1.0", - "postcss": "^8.2.2", + "postcss": "^8.2.4", "postcss-loader": "^4.1.0", "prettier": "^2.2.1", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^5.0.3", + "terser-webpack-plugin": "^5.1.1", "url-loader": "^4.1.1", - "webpack": "^5.11.1", + "webpack": "^5.13.0", "webpack-cli": "^4.3.1", "webpack-dev-middleware": "^4.0.2", "webpack-hot-middleware": "^2.25.0", From 716efe55908ace1076d5a67ab86ea9f694493c1d Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Wed, 13 Jan 2021 15:07:19 +0800 Subject: [PATCH 55/98] =?UTF-8?q?update:=20=E7=AE=80=E5=8C=96=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/container/test/container/page1.js | 3 -- src/container/test/container/page2.js | 3 -- src/container/test/container/page3.js | 3 -- src/container/test/index.js | 3 +- src/container/testclass/container/page1.js | 3 -- src/container/testclass/container/page2.js | 3 -- src/container/testclass/container/page3.js | 4 --- src/models/app.js | 12 +++---- src/models/test.js | 21 ++++++------ src/store/index.js | 2 +- src/util/server.js | 37 ++++++++++++---------- src/util/tools.js | 26 ++++++++------- 12 files changed, 52 insertions(+), 68 deletions(-) diff --git a/src/container/test/container/page1.js b/src/container/test/container/page1.js index e5ecc007..ec99b230 100644 --- a/src/container/test/container/page1.js +++ b/src/container/test/container/page1.js @@ -2,9 +2,6 @@ import React from "react"; import { connect } from "react-redux"; import { bindActionCreators } from "redux"; -// ================== -// 组件 -// ================== function Page1(props) { return
A 子container 1
; } diff --git a/src/container/test/container/page2.js b/src/container/test/container/page2.js index 23481eec..4851157c 100644 --- a/src/container/test/container/page2.js +++ b/src/container/test/container/page2.js @@ -2,9 +2,6 @@ import React from "react"; import { connect } from "react-redux"; import { bindActionCreators } from "redux"; -// ================== -// 组件 -// ================== function Page2(props) { return
B 子container 2
; } diff --git a/src/container/test/container/page3.js b/src/container/test/container/page3.js index 1ba9f4a1..842faa96 100644 --- a/src/container/test/container/page3.js +++ b/src/container/test/container/page3.js @@ -2,9 +2,6 @@ import React from "react"; import { connect } from "react-redux"; import { bindActionCreators } from "redux"; -// ================== -// 组件 -// ================== function Page3(props) { return
C 子container 3
; } diff --git a/src/container/test/index.js b/src/container/test/index.js index c59e45ea..fb8f683d 100644 --- a/src/container/test/index.js +++ b/src/container/test/index.js @@ -25,8 +25,7 @@ function TestPageContainer({ actions, // 上面model中定义的actions对象,自动成为this.props.actions变量 }) { const [visible, setVisible] = useState(false); // 模态框隐藏和显示 - const [mokeFetch, setMokeFetch] = useState([]); // 用于测试fetch请求 - // const [mokeAjax, setMokeAjax] = useState([]); // 用于测试ajax请求 + const [mokeFetch, setMokeFetch] = useState([]); // 用于测试异步请求 const [localCount, setLocalCount] = useState(0); // 数字 const layout = { labelCol: { span: 8 }, diff --git a/src/container/testclass/container/page1.js b/src/container/testclass/container/page1.js index 20143e1c..b1c9f235 100644 --- a/src/container/testclass/container/page1.js +++ b/src/container/testclass/container/page1.js @@ -3,9 +3,6 @@ import { connect } from "react-redux"; import { bindActionCreators } from "redux"; import P from "prop-types"; -// ================== -// 组件 -// ================== class Page1 extends React.Component { static propTypes = { location: P.any, diff --git a/src/container/testclass/container/page2.js b/src/container/testclass/container/page2.js index 19365bda..97d0b92c 100644 --- a/src/container/testclass/container/page2.js +++ b/src/container/testclass/container/page2.js @@ -3,9 +3,6 @@ import { connect } from "react-redux"; import { bindActionCreators } from "redux"; import P from "prop-types"; -// ================== -// 组件 -// ================== class Page2 extends React.Component { static propTypes = { location: P.any, diff --git a/src/container/testclass/container/page3.js b/src/container/testclass/container/page3.js index 316d7938..6cffb101 100644 --- a/src/container/testclass/container/page3.js +++ b/src/container/testclass/container/page3.js @@ -3,10 +3,6 @@ import { connect } from "react-redux"; import { bindActionCreators } from "redux"; import P from "prop-types"; -// ================== -// 组件 -// ================== - class Page3 extends React.Component { static propTypes = { location: P.any, diff --git a/src/models/app.js b/src/models/app.js index 3df7ba33..c674674b 100644 --- a/src/models/app.js +++ b/src/models/app.js @@ -3,24 +3,22 @@ * 可用于存放通用信息,比如用户数据、角色、权限、省市区等通用数据 * **/ export default { - /** store数据 **/ state: { userinfo: null, // 用户信息 }, - /** reducers **/ + reducers: { setUserInfo(state, payload) { - return Object.assign({}, state, { - userinfo: payload, - }); + return { ...state, userinfo: payload }; }, }, - /** actions 可以是一个对象,也可以是一个函数,函数的第1个参数自动被注入dispatch **/ + + /** actions 可以是一个对象,也可以是一个函数,函数的第1个参数自动被注入dispatch(见models/test.js) **/ effects: { // 模拟获取用户信息 async getUserinfo(params = {}) { const user = { id: params.id, username: "admin" }; - this.setUserInfo(user); + this.setUserInfo(user); // 这个setUserInfo就是上面reducers中的setUserInfo return user; }, }, diff --git a/src/models/test.js b/src/models/test.js index 5c723d1f..84b6ac14 100644 --- a/src/models/test.js +++ b/src/models/test.js @@ -7,45 +7,42 @@ import { message } from "antd"; import Server from "../util/server"; // 自己封装的异步请求方法 export default { - /** store数据 **/ state: { count: 0, // 测试数字 fetchvalue: [], // 异步请求的测试数据 }, - /** reducers **/ reducers: { setCount(state, payload) { - return Object.assign({}, state, { - count: payload, - }); + return { ...state, count: payload }; }, setFetchValue(state, payload) { - return Object.assign({}, state, { - fetchvalue: payload, - }); + return { ...state, fetchvalue: payload }; }, }, + /** actions **/ effects: (dispatch) => ({ // 测试 - 数字加1 onTestAdd(params) { this.setCount(params + 1); // 这里会指向上面reducers中的setCount }, + // 测试 - 异步请求 async serverFetch(params = {}) { try { - const res = await Server.newServer( + const res = await Server( "url.ajax", + null, { a: 123, b: "456" }, - "post" + "POST" ); if (res && res.data.status === 200) { - dispatch({ type: "test/setFetchValue", payload: res.data.data }); // dispatch是全局根dispatch,也能这么用 + dispatch({ type: "test/setFetchValue", payload: res.data.data }); // test/setFetchValue对应上面reducers中的setFetchValue } return res.data; } catch (e) { - message.error("网络错误", 1); + message.error("请求错误,请稍后重试"); } }, }), diff --git a/src/store/index.js b/src/store/index.js index 16efc3f3..6a1b60f3 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -6,7 +6,7 @@ import test from "../models/test"; export default init({ models: { - app, // 这里的命名很重要,即这个模块的名字 + app, test, }, }); diff --git a/src/util/server.js b/src/util/server.js index f67b7de4..9c2d6b5b 100644 --- a/src/util/server.js +++ b/src/util/server.js @@ -1,21 +1,26 @@ /** * 自己封装的异步请求函数 - * APP中的所有请求都将汇聚于此 + * 所有http请求都将经过这里 * **/ - import axios from "axios"; -import qs from "qs"; -export default class ApiService { - static newServer(url, bodyObj = {}, type = "post") { - return axios({ - url, - method: type, - headers: { - "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", - }, - withCredentials: true, - data: qs.stringify(bodyObj), - }); - } -} +/** + * 发起http请求 + * @param {String} url 请求的api地址 + * @param {Object} params 这些参数将直接加在api地址后面,如?a=123&b=456 + * @param {Object} body 这些参数将用于POST请求,加到请求的request body中去 + * @param {String} method 请求的方法,如POST/GET + * @return {Promise} 返回一个Promise对象 + */ +export default (url, params = {}, body = {}, method = "POST") => { + return axios({ + url, + method, + headers: { + "Content-Type": "application/json; charset=utf-8", + }, + withCredentials: false, // 请求是否带cookie(跨域的请求一般是不能带cookie的) + params, // GET请求的参数赋给params字段 + data: body, // POST请求的参数赋给data字段 + }); +}; diff --git a/src/util/tools.js b/src/util/tools.js index c605680a..743fea8f 100644 --- a/src/util/tools.js +++ b/src/util/tools.js @@ -3,11 +3,9 @@ const tools = { /** 保留N位小数 - 最终返回的是字符串 - 若转换失败,返回参数原值 - @params - str - 数字或字符串 - x - 保留几位小数点 + @param {Number|String} str 待处理数字 + @param {Number} x 保留几位小数点 + @return {Number|String} 处理成功返回字符串,处理失败返回原值 */ pointX(str, x = 0) { if (!str && str !== 0) { @@ -22,6 +20,8 @@ const tools = { /** 去掉字符串两端空格 + @param {String} str 待处理字符串 + @return {String} 处理后的字符串 */ trim(str) { const reg = /^\s*|\s*$/g; @@ -32,6 +32,8 @@ const tools = { 给字符串打马赛克 如:将123456转换为1****6,最多将字符串中间6个字符变成* 如果字符串长度小于等于2,将不会有效果 + @param {String} str 待处理字符串 + @return {String} 处理后的字符串 */ addMosaic(str) { const s = String(str); @@ -55,28 +57,30 @@ const tools = { }); return ret.join(""); }, + /** - 字符串加密 - 简单的加密方法 + 字符串加密 简单的加密方法 + @param {String} code 待处理字符串 + @param {String} 加密后的字符串 */ compile(code) { let c = String.fromCharCode(code.charCodeAt(0) + code.length); for (let i = 1; i < code.length; i++) { c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1)); } - console.log("加谜:", code, c); return c; }, + /** - 字符串解谜 - 对应上面的字符串加密方法 + 字符串解谜 对应上面的字符串加密方法 + @param {String} code 加密的字符串 + @param {String} 解密后的字符串 */ uncompile(code) { let c = String.fromCharCode(code.charCodeAt(0) - code.length); for (let i = 1; i < code.length; i++) { c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1)); } - console.log("解谜:", code, c); return c; }, }; From 5154d415b8c06e5e37ad510442b9ce2be765dc39 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Wed, 20 Jan 2021 12:48:46 +0800 Subject: [PATCH 56/98] update package --- package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 865789ee..ec0fee1c 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^1.4.0", - "antd": "^4.10.2", + "antd": "^4.10.3", "axios": "^0.21.1", - "core-js": "^3.8.2", + "core-js": "^3.8.3", "history": "^4.10.1", "less": "^4.1.0", "lodash": "^4.17.20", @@ -49,8 +49,8 @@ "@babel/preset-env": "^7.12.11", "@babel/preset-react": "^7.12.10", "@babel/runtime": "^7.12.5", - "antd-dayjs-webpack-plugin": "^1.0.4", - "autoprefixer": "^10.2.1", + "antd-dayjs-webpack-plugin": "^1.0.6", + "autoprefixer": "^10.2.3", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "babel-plugin-import": "^1.13.3", @@ -59,7 +59,7 @@ "copy-webpack-plugin": "^7.0.0", "css-loader": "^5.0.1", "css-minimizer-webpack-plugin": "^1.2.0", - "eslint": "^7.17.0", + "eslint": "^7.18.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-react": "^7.22.0", @@ -70,7 +70,7 @@ "happypack": "^5.0.1", "html-webpack-plugin": "^5.0.0-alpha.7", "less-loader": "^7.2.1", - "mini-css-extract-plugin": "^1.3.3", + "mini-css-extract-plugin": "^1.3.4", "mockjs": "^1.1.0", "postcss": "^8.2.4", "postcss-loader": "^4.1.0", @@ -79,9 +79,9 @@ "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.1", "url-loader": "^4.1.1", - "webpack": "^5.13.0", - "webpack-cli": "^4.3.1", - "webpack-dev-middleware": "^4.0.2", + "webpack": "^5.16.0", + "webpack-cli": "^4.4.0", + "webpack-dev-middleware": "^4.1.0", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", "workbox-webpack-plugin": "^6.0.2", From 4c51aaed9e6003a67c48926c3efbba4f4af07166 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Wed, 27 Jan 2021 17:39:03 +0800 Subject: [PATCH 57/98] antd 4.11.x -> 4.10.x --- package.json | 9 +++++---- webpack.production.config.js | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index ec0fee1c..5f5e2a0c 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ "axios": "^0.21.1", "core-js": "^3.8.3", "history": "^4.10.1", - "less": "^4.1.0", "lodash": "^4.17.20", "react": "^17.0.1", "react-dom": "^17.0.1", @@ -69,17 +68,19 @@ "file-loader": "^6.2.0", "happypack": "^5.0.1", "html-webpack-plugin": "^5.0.0-alpha.7", - "less-loader": "^7.2.1", + "less": "^4.1.0", + "less-loader": "^7.3.0", "mini-css-extract-plugin": "^1.3.4", "mockjs": "^1.1.0", "postcss": "^8.2.4", - "postcss-loader": "^4.1.0", + "postcss-loader": "^4.2.0", "prettier": "^2.2.1", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.1", "url-loader": "^4.1.1", - "webpack": "^5.16.0", + "webpack": "^5.18.0", + "webpack-bundle-analyzer": "^4.4.0", "webpack-cli": "^4.4.0", "webpack-dev-middleware": "^4.1.0", "webpack-hot-middleware": "^2.25.0", diff --git a/webpack.production.config.js b/webpack.production.config.js index e2aa77ae..0b4982fc 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -12,6 +12,7 @@ const CopyPlugin = require("copy-webpack-plugin"); // 用于直接复制public const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); // 自动生成各尺寸的favicon图标 webpack5 wating up const TerserPlugin = require("terser-webpack-plugin"); // 对js进行压缩 const webpackbar = require("webpackbar"); // 进度条 +const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; /** * 基础路径 * 比如我上传到自己的服务器填写的是:"/work/pwa/",最终访问为"https://isluo.com/work/pwa/" @@ -217,6 +218,8 @@ module.exports = { new WorkboxPlugin.GenerateSW({ skipWaiting: true, // service-worker如果有更新的话,跳过等待直接更新 }), + + new BundleAnalyzerPlugin(), ], resolve: { extensions: [".js", ".jsx", ".less", ".css", ".wasm"], // 后缀名自动补全 From b5a56573d6c0d3a333e7d41a9f20b67a75f80d74 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Wed, 27 Jan 2021 18:28:51 +0800 Subject: [PATCH 58/98] update --- webpack.production.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webpack.production.config.js b/webpack.production.config.js index 0b4982fc..5d2b4bd5 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -12,7 +12,7 @@ const CopyPlugin = require("copy-webpack-plugin"); // 用于直接复制public const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); // 自动生成各尺寸的favicon图标 webpack5 wating up const TerserPlugin = require("terser-webpack-plugin"); // 对js进行压缩 const webpackbar = require("webpackbar"); // 进度条 -const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; +// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; // 分析打包后各个包的大小 /** * 基础路径 * 比如我上传到自己的服务器填写的是:"/work/pwa/",最终访问为"https://isluo.com/work/pwa/" @@ -219,7 +219,7 @@ module.exports = { skipWaiting: true, // service-worker如果有更新的话,跳过等待直接更新 }), - new BundleAnalyzerPlugin(), + // new BundleAnalyzerPlugin(), ], resolve: { extensions: [".js", ".jsx", ".less", ".css", ".wasm"], // 后缀名自动补全 From cbe5876989377d34a0a3a5d99f46a03cd0f3954f Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 2 Feb 2021 18:34:36 +0800 Subject: [PATCH 59/98] update packages --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 5f5e2a0c..c39968db 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "pnp": false }, "dependencies": { - "@rematch/core": "^1.4.0", + "@rematch/core": "^2.0.0", "antd": "^4.10.3", "axios": "^0.21.1", "core-js": "^3.8.3", @@ -49,7 +49,7 @@ "@babel/preset-react": "^7.12.10", "@babel/runtime": "^7.12.5", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.2.3", + "autoprefixer": "^10.2.4", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "babel-plugin-import": "^1.13.3", @@ -58,7 +58,7 @@ "copy-webpack-plugin": "^7.0.0", "css-loader": "^5.0.1", "css-minimizer-webpack-plugin": "^1.2.0", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-react": "^7.22.0", @@ -68,9 +68,9 @@ "file-loader": "^6.2.0", "happypack": "^5.0.1", "html-webpack-plugin": "^5.0.0-alpha.7", - "less": "^4.1.0", - "less-loader": "^7.3.0", - "mini-css-extract-plugin": "^1.3.4", + "less": "^4.1.1", + "less-loader": "^8.0.0", + "mini-css-extract-plugin": "^1.3.5", "mockjs": "^1.1.0", "postcss": "^8.2.4", "postcss-loader": "^4.2.0", @@ -79,13 +79,13 @@ "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.1", "url-loader": "^4.1.1", - "webpack": "^5.18.0", + "webpack": "^5.19.0", "webpack-bundle-analyzer": "^4.4.0", "webpack-cli": "^4.4.0", "webpack-dev-middleware": "^4.1.0", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", - "workbox-webpack-plugin": "^6.0.2", + "workbox-webpack-plugin": "^6.1.0", "xml-loader": "^1.2.1" }, "browserslist": [ From 75bbda6c17099b726d4a7095ffc4b708c56de062 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 2 Feb 2021 19:04:38 +0800 Subject: [PATCH 60/98] update yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 11823731..a5d06fa8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,5 @@ node_js: - "12" - "10" script: + - yarn - yarn build From ff772b0d649201403834cd881a2f3e94a7a82124 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 2 Feb 2021 19:06:58 +0800 Subject: [PATCH 61/98] update yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a5d06fa8..57e2c134 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - "12" + - "14" - "10" script: - yarn From 1160220faed86eaa22d7d9cb98142382bcc0418e Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Wed, 3 Feb 2021 11:28:15 +0800 Subject: [PATCH 62/98] update --- package.json | 28 ++++++++++++++-------------- server.js | 20 ++++++++++++-------- src/component/footer/index.js | 4 ++-- src/models/test.js | 9 ++------- src/util/server.js | 8 ++++++++ 5 files changed, 38 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index c39968db..2f8b6599 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^2.0.0", - "antd": "^4.10.3", + "antd": "^4.12.0", "axios": "^0.21.1", "core-js": "^3.8.3", "history": "^4.10.1", @@ -37,17 +37,17 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.12.10", - "@babel/plugin-proposal-class-properties": "^7.12.1", - "@babel/plugin-proposal-decorators": "^7.12.12", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1", - "@babel/plugin-proposal-object-rest-spread": "^7.12.1", - "@babel/plugin-proposal-optional-chaining": "^7.12.7", + "@babel/core": "^7.12.13", + "@babel/plugin-proposal-class-properties": "^7.12.13", + "@babel/plugin-proposal-decorators": "^7.12.13", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.13", + "@babel/plugin-proposal-object-rest-spread": "^7.12.13", + "@babel/plugin-proposal-optional-chaining": "^7.12.13", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.12.10", - "@babel/preset-env": "^7.12.11", - "@babel/preset-react": "^7.12.10", - "@babel/runtime": "^7.12.5", + "@babel/plugin-transform-runtime": "^7.12.13", + "@babel/preset-env": "^7.12.13", + "@babel/preset-react": "^7.12.13", + "@babel/runtime": "^7.12.13", "antd-dayjs-webpack-plugin": "^1.0.6", "autoprefixer": "^10.2.4", "babel-eslint": "^10.1.0", @@ -73,15 +73,15 @@ "mini-css-extract-plugin": "^1.3.5", "mockjs": "^1.1.0", "postcss": "^8.2.4", - "postcss-loader": "^4.2.0", + "postcss-loader": "^5.0.0", "prettier": "^2.2.1", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.1", "url-loader": "^4.1.1", - "webpack": "^5.19.0", + "webpack": "^5.20.0", "webpack-bundle-analyzer": "^4.4.0", - "webpack-cli": "^4.4.0", + "webpack-cli": "^4.5.0", "webpack-dev-middleware": "^4.1.0", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", diff --git a/server.js b/server.js index 2e5ddc99..652b1703 100644 --- a/server.js +++ b/server.js @@ -17,6 +17,16 @@ let PORT = 8888; // 服务启动端口号 app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); +/** 监听POST请求,返回MOCK模拟数据 **/ +app.post(/\/api.*/, (req, res, next) => { + const result = mock.mockApi({ url: req.originalUrl, body: req.body }); + res.send(result); +}); +app.get(/\/api.*/, (req, res, next) => { + const result = mock.mockApi({ url: req.originalUrl, body: req.body }); + res.send(result); +}); + if (env === "production") { // 如果是生产环境,则运行build文件夹中的代码 PORT = 8889; @@ -32,8 +42,8 @@ if (env === "production") { publicPath: webpackConfig.output.publicPath, // 对应webpack配置中的publicPath }), ); - // 挂载HMR热更新中间件 - app.use(webpackHotMiddleware(compiler)); + + app.use(webpackHotMiddleware(compiler)); // 挂载HMR热更新中间件 // 所有请求都返回index.html app.get("*", (req, res, next) => { const filename = path.join(DIST_DIR, "index.html"); @@ -50,12 +60,6 @@ if (env === "production") { }); } -/** 监听POST请求,返回MOCK模拟数据 **/ -app.post("*", (req, res, next) => { - const result = mock.mockApi(req.originalUrl, req.body); - res.send(result); -}); - /** 启动服务 **/ app.listen(PORT, () => { console.log("本地服务启动地址: http://localhost:%s", PORT); diff --git a/src/component/footer/index.js b/src/component/footer/index.js index 6f2f6ccd..aeddf5ee 100644 --- a/src/component/footer/index.js +++ b/src/component/footer/index.js @@ -2,10 +2,10 @@ import React from "react"; import "./index.less"; -export default function Footer(props) { +export default function Footer() { return (
- © 2018-2020{" "} + © 2018-{new Date().getFullYear()}{" "} ({ + effects: dispatch => ({ // 测试 - 数字加1 onTestAdd(params) { this.setCount(params + 1); // 这里会指向上面reducers中的setCount @@ -31,12 +31,7 @@ export default { // 测试 - 异步请求 async serverFetch(params = {}) { try { - const res = await Server( - "url.ajax", - null, - { a: 123, b: "456" }, - "POST" - ); + const res = await Server("/api/url.ajax", null, { a: 123, b: "456" }, "POST"); if (res && res.data.status === 200) { dispatch({ type: "test/setFetchValue", payload: res.data.data }); // test/setFetchValue对应上面reducers中的setFetchValue } diff --git a/src/util/server.js b/src/util/server.js index 9c2d6b5b..487fe24a 100644 --- a/src/util/server.js +++ b/src/util/server.js @@ -4,6 +4,14 @@ * **/ import axios from "axios"; +// 不需要下面这些mock配置,仅本地发布DEMO用 +// import Mock from "mockjs"; +// const mock = require("../../mock/mock-data"); +// Mock.mock(/\/api.*/, options => { +// const res = mock.mockApi(options); +// return res; +// }); + /** * 发起http请求 * @param {String} url 请求的api地址 From 0dc89e6e6b84231eabc5c759ad573546887fc915 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 4 Feb 2021 17:58:19 +0800 Subject: [PATCH 63/98] update packages / add 'favicons' module --- .travis.yml | 1 - package.json | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 57e2c134..f5a7d5d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,5 +3,4 @@ node_js: - "14" - "10" script: - - yarn - yarn build diff --git a/package.json b/package.json index 2f8b6599..5d1f5413 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^2.0.0", - "antd": "^4.12.0", + "antd": "^4.12.2", "axios": "^0.21.1", "core-js": "^3.8.3", "history": "^4.10.1", @@ -64,10 +64,11 @@ "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", - "favicons-webpack-plugin": "^5.0.0-alpha.1", + "favicons": "^6.2.0", + "favicons-webpack-plugin": "^5.0.0", "file-loader": "^6.2.0", "happypack": "^5.0.1", - "html-webpack-plugin": "^5.0.0-alpha.7", + "html-webpack-plugin": "^5.0.0", "less": "^4.1.1", "less-loader": "^8.0.0", "mini-css-extract-plugin": "^1.3.5", @@ -79,7 +80,7 @@ "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.1", "url-loader": "^4.1.1", - "webpack": "^5.20.0", + "webpack": "^5.20.1", "webpack-bundle-analyzer": "^4.4.0", "webpack-cli": "^4.5.0", "webpack-dev-middleware": "^4.1.0", From b99f8a318dd4cead7a99f7882382b1d76046ae17 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 16 Feb 2021 18:13:14 +0800 Subject: [PATCH 64/98] update packages --- package.json | 24 ++++++++++++------------ src/models/test.js | 9 +++++++-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 5d1f5413..d074075d 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^2.0.0", - "antd": "^4.12.2", + "antd": "^4.12.3", "axios": "^0.21.1", "core-js": "^3.8.3", "history": "^4.10.1", @@ -37,15 +37,15 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.12.13", + "@babel/core": "^7.12.16", "@babel/plugin-proposal-class-properties": "^7.12.13", "@babel/plugin-proposal-decorators": "^7.12.13", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.13", "@babel/plugin-proposal-object-rest-spread": "^7.12.13", - "@babel/plugin-proposal-optional-chaining": "^7.12.13", + "@babel/plugin-proposal-optional-chaining": "^7.12.16", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.12.13", - "@babel/preset-env": "^7.12.13", + "@babel/plugin-transform-runtime": "^7.12.15", + "@babel/preset-env": "^7.12.16", "@babel/preset-react": "^7.12.13", "@babel/runtime": "^7.12.13", "antd-dayjs-webpack-plugin": "^1.0.6", @@ -56,31 +56,31 @@ "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^7.0.0", - "css-loader": "^5.0.1", + "css-loader": "^5.0.2", "css-minimizer-webpack-plugin": "^1.2.0", - "eslint": "^7.19.0", + "eslint": "^7.20.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", "favicons": "^6.2.0", - "favicons-webpack-plugin": "^5.0.0", + "favicons-webpack-plugin": "^5.0.1", "file-loader": "^6.2.0", "happypack": "^5.0.1", - "html-webpack-plugin": "^5.0.0", + "html-webpack-plugin": "^5.1.0", "less": "^4.1.1", "less-loader": "^8.0.0", - "mini-css-extract-plugin": "^1.3.5", + "mini-css-extract-plugin": "^1.3.7", "mockjs": "^1.1.0", - "postcss": "^8.2.4", + "postcss": "^8.2.6", "postcss-loader": "^5.0.0", "prettier": "^2.2.1", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.1", "url-loader": "^4.1.1", - "webpack": "^5.20.1", + "webpack": "^5.22.0", "webpack-bundle-analyzer": "^4.4.0", "webpack-cli": "^4.5.0", "webpack-dev-middleware": "^4.1.0", diff --git a/src/models/test.js b/src/models/test.js index b920cccb..4aaf9de7 100644 --- a/src/models/test.js +++ b/src/models/test.js @@ -22,7 +22,7 @@ export default { }, /** actions **/ - effects: dispatch => ({ + effects: (dispatch) => ({ // 测试 - 数字加1 onTestAdd(params) { this.setCount(params + 1); // 这里会指向上面reducers中的setCount @@ -31,7 +31,12 @@ export default { // 测试 - 异步请求 async serverFetch(params = {}) { try { - const res = await Server("/api/url.ajax", null, { a: 123, b: "456" }, "POST"); + const res = await Server( + "/api/url.ajax", + null, + { a: 123, b: "456" }, + "POST" + ); if (res && res.data.status === 200) { dispatch({ type: "test/setFetchValue", payload: res.data.data }); // test/setFetchValue对应上面reducers中的setFetchValue } From fa13108a6f85597171f9e78a370867c8c7df8a41 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Sat, 20 Feb 2021 18:33:38 +0800 Subject: [PATCH 65/98] add dayjs --- package.json | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index d074075d..d6dc2f3a 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@rematch/core": "^2.0.0", "antd": "^4.12.3", "axios": "^0.21.1", - "core-js": "^3.8.3", + "core-js": "^3.9.0", "history": "^4.10.1", "lodash": "^4.17.20", "react": "^17.0.1", @@ -37,17 +37,17 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.12.16", + "@babel/core": "^7.12.17", "@babel/plugin-proposal-class-properties": "^7.12.13", "@babel/plugin-proposal-decorators": "^7.12.13", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.13", "@babel/plugin-proposal-object-rest-spread": "^7.12.13", - "@babel/plugin-proposal-optional-chaining": "^7.12.16", + "@babel/plugin-proposal-optional-chaining": "^7.12.17", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.12.15", - "@babel/preset-env": "^7.12.16", + "@babel/plugin-transform-runtime": "^7.12.17", + "@babel/preset-env": "^7.12.17", "@babel/preset-react": "^7.12.13", - "@babel/runtime": "^7.12.13", + "@babel/runtime": "^7.12.18", "antd-dayjs-webpack-plugin": "^1.0.6", "autoprefixer": "^10.2.4", "babel-eslint": "^10.1.0", @@ -58,20 +58,21 @@ "copy-webpack-plugin": "^7.0.0", "css-loader": "^5.0.2", "css-minimizer-webpack-plugin": "^1.2.0", + "dayjs": "^1.10.4", "eslint": "^7.20.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", - "favicons": "^6.2.0", + "favicons": "^6.2.1", "favicons-webpack-plugin": "^5.0.1", "file-loader": "^6.2.0", "happypack": "^5.0.1", - "html-webpack-plugin": "^5.1.0", + "html-webpack-plugin": "^5.2.0", "less": "^4.1.1", "less-loader": "^8.0.0", - "mini-css-extract-plugin": "^1.3.7", + "mini-css-extract-plugin": "^1.3.8", "mockjs": "^1.1.0", "postcss": "^8.2.6", "postcss-loader": "^5.0.0", @@ -80,7 +81,7 @@ "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.1", "url-loader": "^4.1.1", - "webpack": "^5.22.0", + "webpack": "^5.23.0", "webpack-bundle-analyzer": "^4.4.0", "webpack-cli": "^4.5.0", "webpack-dev-middleware": "^4.1.0", From 80952fc175aaba80bcb1d7da34ea811b8a556487 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Fri, 26 Feb 2021 14:07:18 +0800 Subject: [PATCH 66/98] update packages --- package.json | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index d6dc2f3a..dab2644e 100644 --- a/package.json +++ b/package.json @@ -23,12 +23,12 @@ "pnp": false }, "dependencies": { - "@rematch/core": "^2.0.0", + "@rematch/core": "^2.0.1", "antd": "^4.12.3", "axios": "^0.21.1", "core-js": "^3.9.0", "history": "^4.10.1", - "lodash": "^4.17.20", + "lodash": "^4.17.21", "react": "^17.0.1", "react-dom": "^17.0.1", "react-loadable": "^5.5.0", @@ -37,17 +37,17 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.12.17", - "@babel/plugin-proposal-class-properties": "^7.12.13", - "@babel/plugin-proposal-decorators": "^7.12.13", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.13", - "@babel/plugin-proposal-object-rest-spread": "^7.12.13", - "@babel/plugin-proposal-optional-chaining": "^7.12.17", + "@babel/core": "^7.13.1", + "@babel/plugin-proposal-class-properties": "^7.13.0", + "@babel/plugin-proposal-decorators": "^7.13.5", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.0", + "@babel/plugin-proposal-object-rest-spread": "^7.13.0", + "@babel/plugin-proposal-optional-chaining": "^7.13.0", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.12.17", - "@babel/preset-env": "^7.12.17", + "@babel/plugin-transform-runtime": "^7.13.7", + "@babel/preset-env": "^7.13.5", "@babel/preset-react": "^7.12.13", - "@babel/runtime": "^7.12.18", + "@babel/runtime": "^7.13.7", "antd-dayjs-webpack-plugin": "^1.0.6", "autoprefixer": "^10.2.4", "babel-eslint": "^10.1.0", @@ -56,7 +56,7 @@ "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^7.0.0", - "css-loader": "^5.0.2", + "css-loader": "^5.1.0", "css-minimizer-webpack-plugin": "^1.2.0", "dayjs": "^1.10.4", "eslint": "^7.20.0", @@ -66,13 +66,13 @@ "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", "favicons": "^6.2.1", - "favicons-webpack-plugin": "^5.0.1", + "favicons-webpack-plugin": "^5.0.2", "file-loader": "^6.2.0", "happypack": "^5.0.1", "html-webpack-plugin": "^5.2.0", "less": "^4.1.1", "less-loader": "^8.0.0", - "mini-css-extract-plugin": "^1.3.8", + "mini-css-extract-plugin": "^1.3.9", "mockjs": "^1.1.0", "postcss": "^8.2.6", "postcss-loader": "^5.0.0", @@ -81,13 +81,13 @@ "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.1", "url-loader": "^4.1.1", - "webpack": "^5.23.0", + "webpack": "^5.24.2", "webpack-bundle-analyzer": "^4.4.0", "webpack-cli": "^4.5.0", "webpack-dev-middleware": "^4.1.0", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", - "workbox-webpack-plugin": "^6.1.0", + "workbox-webpack-plugin": "^6.1.1", "xml-loader": "^1.2.1" }, "browserslist": [ From f9abf546c0f95ee95d20a231dce249d6f7001286 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 2 Mar 2021 18:39:04 +0800 Subject: [PATCH 67/98] update packages --- package.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index dab2644e..9fb4f4f1 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^2.0.1", - "antd": "^4.12.3", + "antd": "^4.13.0", "axios": "^0.21.1", - "core-js": "^3.9.0", + "core-js": "^3.9.1", "history": "^4.10.1", "lodash": "^4.17.21", "react": "^17.0.1", @@ -37,17 +37,17 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.13.1", + "@babel/core": "^7.13.8", "@babel/plugin-proposal-class-properties": "^7.13.0", "@babel/plugin-proposal-decorators": "^7.13.5", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.0", - "@babel/plugin-proposal-object-rest-spread": "^7.13.0", - "@babel/plugin-proposal-optional-chaining": "^7.13.0", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8", + "@babel/plugin-proposal-object-rest-spread": "^7.13.8", + "@babel/plugin-proposal-optional-chaining": "^7.13.8", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.13.7", - "@babel/preset-env": "^7.13.5", + "@babel/plugin-transform-runtime": "^7.13.9", + "@babel/preset-env": "^7.13.9", "@babel/preset-react": "^7.12.13", - "@babel/runtime": "^7.13.7", + "@babel/runtime": "^7.13.9", "antd-dayjs-webpack-plugin": "^1.0.6", "autoprefixer": "^10.2.4", "babel-eslint": "^10.1.0", @@ -56,10 +56,10 @@ "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^7.0.0", - "css-loader": "^5.1.0", + "css-loader": "^5.1.1", "css-minimizer-webpack-plugin": "^1.2.0", "dayjs": "^1.10.4", - "eslint": "^7.20.0", + "eslint": "^7.21.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-react": "^7.22.0", From 1e19168a544e99eb61ea81bd926ef297f7e123ae Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Mon, 22 Mar 2021 10:59:08 +0800 Subject: [PATCH 68/98] update packages --- package.json | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 9fb4f4f1..0c36c5a5 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^2.0.1", - "antd": "^4.13.0", + "antd": "^4.14.0", "axios": "^0.21.1", "core-js": "^3.9.1", "history": "^4.10.1", @@ -37,29 +37,29 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.13.8", + "@babel/core": "^7.13.10", "@babel/plugin-proposal-class-properties": "^7.13.0", "@babel/plugin-proposal-decorators": "^7.13.5", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8", "@babel/plugin-proposal-object-rest-spread": "^7.13.8", "@babel/plugin-proposal-optional-chaining": "^7.13.8", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.13.9", - "@babel/preset-env": "^7.13.9", + "@babel/plugin-transform-runtime": "^7.13.10", + "@babel/preset-env": "^7.13.10", "@babel/preset-react": "^7.12.13", - "@babel/runtime": "^7.13.9", + "@babel/runtime": "^7.13.10", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.2.4", + "autoprefixer": "^10.2.5", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "babel-plugin-import": "^1.13.3", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "copy-webpack-plugin": "^7.0.0", - "css-loader": "^5.1.1", - "css-minimizer-webpack-plugin": "^1.2.0", + "copy-webpack-plugin": "^8.0.0", + "css-loader": "^5.1.3", + "css-minimizer-webpack-plugin": "^1.3.0", "dayjs": "^1.10.4", - "eslint": "^7.21.0", + "eslint": "^7.22.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-react": "^7.22.0", @@ -69,25 +69,25 @@ "favicons-webpack-plugin": "^5.0.2", "file-loader": "^6.2.0", "happypack": "^5.0.1", - "html-webpack-plugin": "^5.2.0", + "html-webpack-plugin": "^5.3.1", "less": "^4.1.1", "less-loader": "^8.0.0", "mini-css-extract-plugin": "^1.3.9", "mockjs": "^1.1.0", - "postcss": "^8.2.6", - "postcss-loader": "^5.0.0", + "postcss": "^8.2.8", + "postcss-loader": "^5.2.0", "prettier": "^2.2.1", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.1", "url-loader": "^4.1.1", - "webpack": "^5.24.2", + "webpack": "^5.27.1", "webpack-bundle-analyzer": "^4.4.0", "webpack-cli": "^4.5.0", "webpack-dev-middleware": "^4.1.0", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", - "workbox-webpack-plugin": "^6.1.1", + "workbox-webpack-plugin": "^6.1.2", "xml-loader": "^1.2.1" }, "browserslist": [ From f4cfa67d142e08fccc35b2bf0c2477769f8e527a Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Tue, 6 Apr 2021 16:56:37 +0800 Subject: [PATCH 69/98] update --- package.json | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 0c36c5a5..b4b60c41 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "cover": "./node_modules/.bin/istanbul cover _mocha", "coveralls": "npm run cover -- --report lcovonly && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls" }, - "author": "L", + "author": "admin", "license": "ISC", "private": true, "repository": { @@ -24,29 +24,29 @@ }, "dependencies": { "@rematch/core": "^2.0.1", - "antd": "^4.14.0", + "antd": "^4.15.0", "axios": "^0.21.1", - "core-js": "^3.9.1", + "core-js": "^3.10.0", "history": "^4.10.1", "lodash": "^4.17.21", - "react": "^17.0.1", - "react-dom": "^17.0.1", + "react": "^17.0.2", + "react-dom": "^17.0.2", "react-loadable": "^5.5.0", - "react-redux": "^7.2.2", + "react-redux": "^7.2.3", "react-router-dom": "^5.2.0", "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.13.10", + "@babel/core": "^7.13.14", "@babel/plugin-proposal-class-properties": "^7.13.0", "@babel/plugin-proposal-decorators": "^7.13.5", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8", "@babel/plugin-proposal-object-rest-spread": "^7.13.8", - "@babel/plugin-proposal-optional-chaining": "^7.13.8", + "@babel/plugin-proposal-optional-chaining": "^7.13.12", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-runtime": "^7.13.10", - "@babel/preset-env": "^7.13.10", - "@babel/preset-react": "^7.12.13", + "@babel/preset-env": "^7.13.12", + "@babel/preset-react": "^7.13.13", "@babel/runtime": "^7.13.10", "antd-dayjs-webpack-plugin": "^1.0.6", "autoprefixer": "^10.2.5", @@ -55,14 +55,14 @@ "babel-plugin-import": "^1.13.3", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "copy-webpack-plugin": "^8.0.0", - "css-loader": "^5.1.3", + "copy-webpack-plugin": "^8.1.0", + "css-loader": "^5.2.0", "css-minimizer-webpack-plugin": "^1.3.0", "dayjs": "^1.10.4", - "eslint": "^7.22.0", + "eslint": "^7.23.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.3.1", - "eslint-plugin-react": "^7.22.0", + "eslint-plugin-react": "^7.23.1", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", "favicons": "^6.2.1", @@ -72,18 +72,18 @@ "html-webpack-plugin": "^5.3.1", "less": "^4.1.1", "less-loader": "^8.0.0", - "mini-css-extract-plugin": "^1.3.9", + "mini-css-extract-plugin": "^1.4.0", "mockjs": "^1.1.0", - "postcss": "^8.2.8", + "postcss": "^8.2.9", "postcss-loader": "^5.2.0", "prettier": "^2.2.1", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.1", "url-loader": "^4.1.1", - "webpack": "^5.27.1", + "webpack": "^5.30.0", "webpack-bundle-analyzer": "^4.4.0", - "webpack-cli": "^4.5.0", + "webpack-cli": "^4.6.0", "webpack-dev-middleware": "^4.1.0", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", From 045c25dbc74849e1a6f4d61d52a917682c28178b Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Mon, 12 Apr 2021 14:50:44 +0800 Subject: [PATCH 70/98] update packages --- package.json | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index b4b60c41..88395e13 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^2.0.1", - "antd": "^4.15.0", + "antd": "^4.15.1", "axios": "^0.21.1", - "core-js": "^3.10.0", + "core-js": "^3.10.1", "history": "^4.10.1", "lodash": "^4.17.21", "react": "^17.0.2", @@ -37,15 +37,15 @@ "redux": "^4.0.5" }, "devDependencies": { - "@babel/core": "^7.13.14", + "@babel/core": "^7.13.15", "@babel/plugin-proposal-class-properties": "^7.13.0", - "@babel/plugin-proposal-decorators": "^7.13.5", + "@babel/plugin-proposal-decorators": "^7.13.15", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8", "@babel/plugin-proposal-object-rest-spread": "^7.13.8", "@babel/plugin-proposal-optional-chaining": "^7.13.12", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.13.10", - "@babel/preset-env": "^7.13.12", + "@babel/plugin-transform-runtime": "^7.13.15", + "@babel/preset-env": "^7.13.15", "@babel/preset-react": "^7.13.13", "@babel/runtime": "^7.13.10", "antd-dayjs-webpack-plugin": "^1.0.6", @@ -55,14 +55,14 @@ "babel-plugin-import": "^1.13.3", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "copy-webpack-plugin": "^8.1.0", - "css-loader": "^5.2.0", - "css-minimizer-webpack-plugin": "^1.3.0", + "copy-webpack-plugin": "^8.1.1", + "css-loader": "^5.2.1", + "css-minimizer-webpack-plugin": "^2.0.0", "dayjs": "^1.10.4", - "eslint": "^7.23.0", + "eslint": "^7.24.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.3.1", - "eslint-plugin-react": "^7.23.1", + "eslint-plugin-react": "^7.23.2", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", "favicons": "^6.2.1", @@ -71,17 +71,17 @@ "happypack": "^5.0.1", "html-webpack-plugin": "^5.3.1", "less": "^4.1.1", - "less-loader": "^8.0.0", - "mini-css-extract-plugin": "^1.4.0", + "less-loader": "^8.1.0", + "mini-css-extract-plugin": "^1.4.1", "mockjs": "^1.1.0", - "postcss": "^8.2.9", + "postcss": "^8.2.10", "postcss-loader": "^5.2.0", "prettier": "^2.2.1", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.1", "url-loader": "^4.1.1", - "webpack": "^5.30.0", + "webpack": "^5.31.2", "webpack-bundle-analyzer": "^4.4.0", "webpack-cli": "^4.6.0", "webpack-dev-middleware": "^4.1.0", From c9edfe3d8862c29a4537c52f40b53aca6862ee37 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 20 Apr 2021 18:55:57 +0800 Subject: [PATCH 71/98] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3bfea5b4..5553a1b2 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ yarn prettier # 自动格式化src、mock目录下的所有.js/.css/.scss/.less ## 预览地址 Demo -https://isluo.com/work/pwa/ (线上没有 mock 环境) +https://isluo.com/work/pwa/ ## 参阅资料 From 13548cc681a576a0fc34028abde5cf28d867ca92 Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Thu, 29 Apr 2021 18:20:31 +0800 Subject: [PATCH 72/98] update packages --- package.json | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 88395e13..5f7c11ef 100644 --- a/package.json +++ b/package.json @@ -24,20 +24,20 @@ }, "dependencies": { "@rematch/core": "^2.0.1", - "antd": "^4.15.1", + "antd": "^4.15.3", "axios": "^0.21.1", - "core-js": "^3.10.1", + "core-js": "^3.11.1", "history": "^4.10.1", "lodash": "^4.17.21", "react": "^17.0.2", "react-dom": "^17.0.2", "react-loadable": "^5.5.0", - "react-redux": "^7.2.3", + "react-redux": "^7.2.4", "react-router-dom": "^5.2.0", - "redux": "^4.0.5" + "redux": "^4.1.0" }, "devDependencies": { - "@babel/core": "^7.13.15", + "@babel/core": "^7.13.16", "@babel/plugin-proposal-class-properties": "^7.13.0", "@babel/plugin-proposal-decorators": "^7.13.15", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8", @@ -47,7 +47,7 @@ "@babel/plugin-transform-runtime": "^7.13.15", "@babel/preset-env": "^7.13.15", "@babel/preset-react": "^7.13.13", - "@babel/runtime": "^7.13.10", + "@babel/runtime": "^7.13.17", "antd-dayjs-webpack-plugin": "^1.0.6", "autoprefixer": "^10.2.5", "babel-eslint": "^10.1.0", @@ -56,12 +56,12 @@ "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^8.1.1", - "css-loader": "^5.2.1", + "css-loader": "^5.2.4", "css-minimizer-webpack-plugin": "^2.0.0", "dayjs": "^1.10.4", - "eslint": "^7.24.0", + "eslint": "^7.25.0", "eslint-loader": "^4.0.2", - "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-react": "^7.23.2", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", @@ -71,23 +71,23 @@ "happypack": "^5.0.1", "html-webpack-plugin": "^5.3.1", "less": "^4.1.1", - "less-loader": "^8.1.0", - "mini-css-extract-plugin": "^1.4.1", + "less-loader": "^8.1.1", + "mini-css-extract-plugin": "^1.5.1", "mockjs": "^1.1.0", - "postcss": "^8.2.10", + "postcss": "^8.2.13", "postcss-loader": "^5.2.0", "prettier": "^2.2.1", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.1", "url-loader": "^4.1.1", - "webpack": "^5.31.2", - "webpack-bundle-analyzer": "^4.4.0", + "webpack": "^5.36.1", + "webpack-bundle-analyzer": "^4.4.1", "webpack-cli": "^4.6.0", "webpack-dev-middleware": "^4.1.0", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", - "workbox-webpack-plugin": "^6.1.2", + "workbox-webpack-plugin": "^6.1.5", "xml-loader": "^1.2.1" }, "browserslist": [ From 51d99e9cdf69108fc50b071a9f4d0c96144cf4e1 Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Fri, 14 May 2021 11:53:32 +0800 Subject: [PATCH 73/98] update packages --- package.json | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 5f7c11ef..9d2339f0 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^2.0.1", - "antd": "^4.15.3", + "antd": "^4.15.5", "axios": "^0.21.1", - "core-js": "^3.11.1", + "core-js": "^3.12.1", "history": "^4.10.1", "lodash": "^4.17.21", "react": "^17.0.2", @@ -37,17 +37,17 @@ "redux": "^4.1.0" }, "devDependencies": { - "@babel/core": "^7.13.16", + "@babel/core": "^7.14.2", "@babel/plugin-proposal-class-properties": "^7.13.0", - "@babel/plugin-proposal-decorators": "^7.13.15", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8", - "@babel/plugin-proposal-object-rest-spread": "^7.13.8", - "@babel/plugin-proposal-optional-chaining": "^7.13.12", + "@babel/plugin-proposal-decorators": "^7.14.2", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.2", + "@babel/plugin-proposal-object-rest-spread": "^7.14.2", + "@babel/plugin-proposal-optional-chaining": "^7.14.2", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.13.15", - "@babel/preset-env": "^7.13.15", + "@babel/plugin-transform-runtime": "^7.14.2", + "@babel/preset-env": "^7.14.2", "@babel/preset-react": "^7.13.13", - "@babel/runtime": "^7.13.17", + "@babel/runtime": "^7.14.0", "antd-dayjs-webpack-plugin": "^1.0.6", "autoprefixer": "^10.2.5", "babel-eslint": "^10.1.0", @@ -57,34 +57,34 @@ "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^8.1.1", "css-loader": "^5.2.4", - "css-minimizer-webpack-plugin": "^2.0.0", + "css-minimizer-webpack-plugin": "^3.0.0", "dayjs": "^1.10.4", - "eslint": "^7.25.0", + "eslint": "^7.26.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-react": "^7.23.2", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", - "favicons": "^6.2.1", + "favicons": "^6.2.2", "favicons-webpack-plugin": "^5.0.2", "file-loader": "^6.2.0", "happypack": "^5.0.1", "html-webpack-plugin": "^5.3.1", "less": "^4.1.1", - "less-loader": "^8.1.1", - "mini-css-extract-plugin": "^1.5.1", + "less-loader": "^9.0.0", + "mini-css-extract-plugin": "^1.6.0", "mockjs": "^1.1.0", - "postcss": "^8.2.13", + "postcss": "^8.2.15", "postcss-loader": "^5.2.0", - "prettier": "^2.2.1", + "prettier": "^2.3.0", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^5.1.1", + "terser-webpack-plugin": "^5.1.2", "url-loader": "^4.1.1", - "webpack": "^5.36.1", + "webpack": "^5.37.0", "webpack-bundle-analyzer": "^4.4.1", - "webpack-cli": "^4.6.0", - "webpack-dev-middleware": "^4.1.0", + "webpack-cli": "^4.7.0", + "webpack-dev-middleware": "^4.2.0", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", "workbox-webpack-plugin": "^6.1.5", From a91c12d86b701478266b1914faf8c0d4f8aa943c Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Mon, 24 May 2021 14:04:07 +0800 Subject: [PATCH 74/98] update packages --- package.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 9d2339f0..c071e5c7 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^2.0.1", - "antd": "^4.15.5", + "antd": "^4.15.6", "axios": "^0.21.1", "core-js": "^3.12.1", "history": "^4.10.1", @@ -37,14 +37,14 @@ "redux": "^4.1.0" }, "devDependencies": { - "@babel/core": "^7.14.2", + "@babel/core": "^7.14.3", "@babel/plugin-proposal-class-properties": "^7.13.0", "@babel/plugin-proposal-decorators": "^7.14.2", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.2", "@babel/plugin-proposal-object-rest-spread": "^7.14.2", "@babel/plugin-proposal-optional-chaining": "^7.14.2", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.14.2", + "@babel/plugin-transform-runtime": "^7.14.3", "@babel/preset-env": "^7.14.2", "@babel/preset-react": "^7.13.13", "@babel/runtime": "^7.14.0", @@ -55,11 +55,11 @@ "babel-plugin-import": "^1.13.3", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "copy-webpack-plugin": "^8.1.1", - "css-loader": "^5.2.4", + "copy-webpack-plugin": "^9.0.0", + "css-loader": "^5.2.5", "css-minimizer-webpack-plugin": "^3.0.0", "dayjs": "^1.10.4", - "eslint": "^7.26.0", + "eslint": "^7.27.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-react": "^7.23.2", @@ -74,17 +74,17 @@ "less-loader": "^9.0.0", "mini-css-extract-plugin": "^1.6.0", "mockjs": "^1.1.0", - "postcss": "^8.2.15", - "postcss-loader": "^5.2.0", + "postcss": "^8.3.0", + "postcss-loader": "^5.3.0", "prettier": "^2.3.0", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.2", "url-loader": "^4.1.1", - "webpack": "^5.37.0", - "webpack-bundle-analyzer": "^4.4.1", + "webpack": "^5.37.1", + "webpack-bundle-analyzer": "^4.4.2", "webpack-cli": "^4.7.0", - "webpack-dev-middleware": "^4.2.0", + "webpack-dev-middleware": "^4.3.0", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", "workbox-webpack-plugin": "^6.1.5", From c52fce3007a20c68974187db084b12d087b4ba99 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Mon, 31 May 2021 16:54:28 +0800 Subject: [PATCH 75/98] update packages --- package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index c071e5c7..88fd82ce 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^2.0.1", - "antd": "^4.15.6", + "antd": "^4.16.1", "axios": "^0.21.1", - "core-js": "^3.12.1", + "core-js": "^3.13.1", "history": "^4.10.1", "lodash": "^4.17.21", "react": "^17.0.2", @@ -41,28 +41,28 @@ "@babel/plugin-proposal-class-properties": "^7.13.0", "@babel/plugin-proposal-decorators": "^7.14.2", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.2", - "@babel/plugin-proposal-object-rest-spread": "^7.14.2", + "@babel/plugin-proposal-object-rest-spread": "^7.14.4", "@babel/plugin-proposal-optional-chaining": "^7.14.2", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-runtime": "^7.14.3", - "@babel/preset-env": "^7.14.2", + "@babel/preset-env": "^7.14.4", "@babel/preset-react": "^7.13.13", "@babel/runtime": "^7.14.0", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.2.5", + "autoprefixer": "^10.2.6", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "babel-plugin-import": "^1.13.3", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^9.0.0", - "css-loader": "^5.2.5", + "css-loader": "^5.2.6", "css-minimizer-webpack-plugin": "^3.0.0", - "dayjs": "^1.10.4", + "dayjs": "^1.10.5", "eslint": "^7.27.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.4.0", - "eslint-plugin-react": "^7.23.2", + "eslint-plugin-react": "^7.24.0", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", "favicons": "^6.2.2", @@ -81,7 +81,7 @@ "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.2", "url-loader": "^4.1.1", - "webpack": "^5.37.1", + "webpack": "^5.38.1", "webpack-bundle-analyzer": "^4.4.2", "webpack-cli": "^4.7.0", "webpack-dev-middleware": "^4.3.0", From 944ec5f08f29fd95f90216a31ed8f101e75e1482 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Tue, 15 Jun 2021 14:12:53 +0800 Subject: [PATCH 76/98] update --- package.json | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 88fd82ce..b5188610 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^2.0.1", - "antd": "^4.16.1", + "antd": "^4.16.3", "axios": "^0.21.1", - "core-js": "^3.13.1", + "core-js": "^3.14.0", "history": "^4.10.1", "lodash": "^4.17.21", "react": "^17.0.2", @@ -37,17 +37,17 @@ "redux": "^4.1.0" }, "devDependencies": { - "@babel/core": "^7.14.3", - "@babel/plugin-proposal-class-properties": "^7.13.0", - "@babel/plugin-proposal-decorators": "^7.14.2", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.2", - "@babel/plugin-proposal-object-rest-spread": "^7.14.4", - "@babel/plugin-proposal-optional-chaining": "^7.14.2", + "@babel/core": "^7.14.6", + "@babel/plugin-proposal-class-properties": "^7.14.5", + "@babel/plugin-proposal-decorators": "^7.14.5", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5", + "@babel/plugin-proposal-object-rest-spread": "^7.14.5", + "@babel/plugin-proposal-optional-chaining": "^7.14.5", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.14.3", - "@babel/preset-env": "^7.14.4", - "@babel/preset-react": "^7.13.13", - "@babel/runtime": "^7.14.0", + "@babel/plugin-transform-runtime": "^7.14.5", + "@babel/preset-env": "^7.14.5", + "@babel/preset-react": "^7.14.5", + "@babel/runtime": "^7.14.6", "antd-dayjs-webpack-plugin": "^1.0.6", "autoprefixer": "^10.2.6", "babel-eslint": "^10.1.0", @@ -57,9 +57,9 @@ "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^9.0.0", "css-loader": "^5.2.6", - "css-minimizer-webpack-plugin": "^3.0.0", + "css-minimizer-webpack-plugin": "^3.0.1", "dayjs": "^1.10.5", - "eslint": "^7.27.0", + "eslint": "^7.28.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-react": "^7.24.0", @@ -71,20 +71,20 @@ "happypack": "^5.0.1", "html-webpack-plugin": "^5.3.1", "less": "^4.1.1", - "less-loader": "^9.0.0", + "less-loader": "^9.1.0", "mini-css-extract-plugin": "^1.6.0", "mockjs": "^1.1.0", - "postcss": "^8.3.0", - "postcss-loader": "^5.3.0", - "prettier": "^2.3.0", + "postcss": "^8.3.4", + "postcss-loader": "^6.1.0", + "prettier": "^2.3.1", "style-loader": "^2.0.0", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^5.1.2", + "terser-webpack-plugin": "^5.1.3", "url-loader": "^4.1.1", - "webpack": "^5.38.1", + "webpack": "^5.39.0", "webpack-bundle-analyzer": "^4.4.2", - "webpack-cli": "^4.7.0", - "webpack-dev-middleware": "^4.3.0", + "webpack-cli": "^4.7.2", + "webpack-dev-middleware": "^5.0.0", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", "workbox-webpack-plugin": "^6.1.5", @@ -97,4 +97,4 @@ "not dead", "not op_mini all" ] -} +} \ No newline at end of file From 2598600088af36c7d0b5f17ba03e3289afac91b1 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 15 Jul 2021 23:25:55 +0800 Subject: [PATCH 77/98] update packages --- package.json | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index b5188610..237b3b3f 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^2.0.1", - "antd": "^4.16.3", + "antd": "^4.16.7", "axios": "^0.21.1", - "core-js": "^3.14.0", + "core-js": "^3.15.2", "history": "^4.10.1", "lodash": "^4.17.21", "react": "^17.0.2", @@ -41,25 +41,25 @@ "@babel/plugin-proposal-class-properties": "^7.14.5", "@babel/plugin-proposal-decorators": "^7.14.5", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5", - "@babel/plugin-proposal-object-rest-spread": "^7.14.5", + "@babel/plugin-proposal-object-rest-spread": "^7.14.7", "@babel/plugin-proposal-optional-chaining": "^7.14.5", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-runtime": "^7.14.5", - "@babel/preset-env": "^7.14.5", + "@babel/preset-env": "^7.14.7", "@babel/preset-react": "^7.14.5", "@babel/runtime": "^7.14.6", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.2.6", + "autoprefixer": "^10.3.1", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "babel-plugin-import": "^1.13.3", "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", - "copy-webpack-plugin": "^9.0.0", - "css-loader": "^5.2.6", - "css-minimizer-webpack-plugin": "^3.0.1", - "dayjs": "^1.10.5", - "eslint": "^7.28.0", + "copy-webpack-plugin": "^9.0.1", + "css-loader": "^6.0.0", + "css-minimizer-webpack-plugin": "^3.0.2", + "dayjs": "^1.10.6", + "eslint": "^7.30.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-react": "^7.24.0", @@ -69,19 +69,19 @@ "favicons-webpack-plugin": "^5.0.2", "file-loader": "^6.2.0", "happypack": "^5.0.1", - "html-webpack-plugin": "^5.3.1", + "html-webpack-plugin": "^5.3.2", "less": "^4.1.1", - "less-loader": "^9.1.0", - "mini-css-extract-plugin": "^1.6.0", + "less-loader": "^10.0.1", + "mini-css-extract-plugin": "^2.1.0", "mockjs": "^1.1.0", - "postcss": "^8.3.4", - "postcss-loader": "^6.1.0", - "prettier": "^2.3.1", - "style-loader": "^2.0.0", + "postcss": "^8.3.5", + "postcss-loader": "^6.1.1", + "prettier": "^2.3.2", + "style-loader": "^3.1.0", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^5.1.3", + "terser-webpack-plugin": "^5.1.4", "url-loader": "^4.1.1", - "webpack": "^5.39.0", + "webpack": "^5.44.0", "webpack-bundle-analyzer": "^4.4.2", "webpack-cli": "^4.7.2", "webpack-dev-middleware": "^5.0.0", From e05e4a938a94be35f922f8b672248becbda57877 Mon Sep 17 00:00:00 2001 From: dreamerryao Date: Tue, 3 Aug 2021 20:10:52 +0800 Subject: [PATCH 78/98] =?UTF-8?q?upd:=20=E5=88=A0=E9=99=A4body-parser?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - server.js | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 237b3b3f..dbca0296 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "babel-plugin-import": "^1.13.3", - "body-parser": "^1.19.0", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^9.0.1", "css-loader": "^6.0.0", diff --git a/server.js b/server.js index 652b1703..43541fd0 100644 --- a/server.js +++ b/server.js @@ -1,7 +1,6 @@ /** 用于开发环境的服务启动 **/ const path = require("path"); // 获取绝对路径有用 const express = require("express"); // express服务器端框架 -const bodyParser = require("body-parser"); const env = process.env.NODE_ENV; // 模式(dev开发环境,production生产环境) const webpack = require("webpack"); // webpack核心 const webpackDevMiddleware = require("webpack-dev-middleware"); // webpack服务器 @@ -14,8 +13,8 @@ const app = express(); // 实例化express服务 const DIST_DIR = webpackConfig.output.path; // webpack配置中设置的文件输出路径,所有文件存放在内存中 let PORT = 8888; // 服务启动端口号 -app.use(bodyParser.urlencoded({ extended: false })); -app.use(bodyParser.json()); +app.use(express.urlencoded({ extended: false })); +app.use(express.json()); /** 监听POST请求,返回MOCK模拟数据 **/ app.post(/\/api.*/, (req, res, next) => { From 4e29d2951b7b54d1b9a689ca433541dfe788e946 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Wed, 18 Aug 2021 23:02:10 +0800 Subject: [PATCH 79/98] update packages --- package.json | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index dbca0296..c27fd042 100644 --- a/package.json +++ b/package.json @@ -23,10 +23,10 @@ "pnp": false }, "dependencies": { - "@rematch/core": "^2.0.1", - "antd": "^4.16.7", + "@rematch/core": "^2.1.0", + "antd": "^4.16.12", "axios": "^0.21.1", - "core-js": "^3.15.2", + "core-js": "^3.16.2", "history": "^4.10.1", "lodash": "^4.17.21", "react": "^17.0.2", @@ -34,20 +34,20 @@ "react-loadable": "^5.5.0", "react-redux": "^7.2.4", "react-router-dom": "^5.2.0", - "redux": "^4.1.0" + "redux": "^4.1.1" }, "devDependencies": { - "@babel/core": "^7.14.6", + "@babel/core": "^7.15.0", "@babel/plugin-proposal-class-properties": "^7.14.5", "@babel/plugin-proposal-decorators": "^7.14.5", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5", "@babel/plugin-proposal-object-rest-spread": "^7.14.7", "@babel/plugin-proposal-optional-chaining": "^7.14.5", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.14.5", - "@babel/preset-env": "^7.14.7", + "@babel/plugin-transform-runtime": "^7.15.0", + "@babel/preset-env": "^7.15.0", "@babel/preset-react": "^7.14.5", - "@babel/runtime": "^7.14.6", + "@babel/runtime": "^7.15.3", "antd-dayjs-webpack-plugin": "^1.0.6", "autoprefixer": "^10.3.1", "babel-eslint": "^10.1.0", @@ -55,10 +55,10 @@ "babel-plugin-import": "^1.13.3", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^9.0.1", - "css-loader": "^6.0.0", + "css-loader": "^6.2.0", "css-minimizer-webpack-plugin": "^3.0.2", "dayjs": "^1.10.6", - "eslint": "^7.30.0", + "eslint": "^7.32.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-react": "^7.24.0", @@ -71,22 +71,22 @@ "html-webpack-plugin": "^5.3.2", "less": "^4.1.1", "less-loader": "^10.0.1", - "mini-css-extract-plugin": "^2.1.0", + "mini-css-extract-plugin": "^2.2.0", "mockjs": "^1.1.0", - "postcss": "^8.3.5", + "postcss": "^8.3.6", "postcss-loader": "^6.1.1", "prettier": "^2.3.2", - "style-loader": "^3.1.0", + "style-loader": "^3.2.1", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.4", "url-loader": "^4.1.1", - "webpack": "^5.44.0", + "webpack": "^5.50.0", "webpack-bundle-analyzer": "^4.4.2", - "webpack-cli": "^4.7.2", + "webpack-cli": "^4.8.0", "webpack-dev-middleware": "^5.0.0", "webpack-hot-middleware": "^2.25.0", "webpackbar": "^4.0.0", - "workbox-webpack-plugin": "^6.1.5", + "workbox-webpack-plugin": "^6.2.4", "xml-loader": "^1.2.1" }, "browserslist": [ From 4d103cc4a71f0af173862c6914b38606d65b6212 Mon Sep 17 00:00:00 2001 From: Logic <376693576@qq.com> Date: Thu, 26 Aug 2021 18:35:40 +0800 Subject: [PATCH 80/98] update packages --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c27fd042..3ae20e7d 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^2.1.0", - "antd": "^4.16.12", + "antd": "^4.16.13", "axios": "^0.21.1", - "core-js": "^3.16.2", + "core-js": "^3.16.3", "history": "^4.10.1", "lodash": "^4.17.21", "react": "^17.0.2", @@ -49,7 +49,7 @@ "@babel/preset-react": "^7.14.5", "@babel/runtime": "^7.15.3", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.3.1", + "autoprefixer": "^10.3.2", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "babel-plugin-import": "^1.13.3", @@ -60,7 +60,7 @@ "dayjs": "^1.10.6", "eslint": "^7.32.0", "eslint-loader": "^4.0.2", - "eslint-plugin-prettier": "^3.4.0", + "eslint-plugin-prettier": "^3.4.1", "eslint-plugin-react": "^7.24.0", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", @@ -80,7 +80,7 @@ "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.1.4", "url-loader": "^4.1.1", - "webpack": "^5.50.0", + "webpack": "^5.51.1", "webpack-bundle-analyzer": "^4.4.2", "webpack-cli": "^4.8.0", "webpack-dev-middleware": "^5.0.0", From 4051584e72c4139cc3720a9c1cc8dde8664ead31 Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Mon, 30 Aug 2021 10:58:47 +0800 Subject: [PATCH 81/98] update server.js --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 43541fd0..84aa6508 100644 --- a/server.js +++ b/server.js @@ -30,7 +30,7 @@ if (env === "production") { // 如果是生产环境,则运行build文件夹中的代码 PORT = 8889; app.use(express.static("build")); - app.get("*", function (req, res) { + app.get("*", (req, res) => { res.sendFile(path.join(__dirname, "build", "index.html")); }); } else { From 2ea0ca35b8e73cb44fcd93b78567d9ee75bf260d Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Sun, 26 Sep 2021 19:02:46 +0800 Subject: [PATCH 82/98] update package --- package.json | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 3ae20e7d..caca5c10 100644 --- a/package.json +++ b/package.json @@ -25,43 +25,43 @@ "dependencies": { "@rematch/core": "^2.1.0", "antd": "^4.16.13", - "axios": "^0.21.1", - "core-js": "^3.16.3", + "axios": "^0.21.4", + "core-js": "^3.18.0", "history": "^4.10.1", "lodash": "^4.17.21", "react": "^17.0.2", "react-dom": "^17.0.2", "react-loadable": "^5.5.0", - "react-redux": "^7.2.4", - "react-router-dom": "^5.2.0", + "react-redux": "^7.2.5", + "react-router-dom": "^5.3.0", "redux": "^4.1.1" }, "devDependencies": { - "@babel/core": "^7.15.0", + "@babel/core": "^7.15.5", "@babel/plugin-proposal-class-properties": "^7.14.5", - "@babel/plugin-proposal-decorators": "^7.14.5", + "@babel/plugin-proposal-decorators": "^7.15.4", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5", - "@babel/plugin-proposal-object-rest-spread": "^7.14.7", + "@babel/plugin-proposal-object-rest-spread": "^7.15.6", "@babel/plugin-proposal-optional-chaining": "^7.14.5", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-runtime": "^7.15.0", - "@babel/preset-env": "^7.15.0", + "@babel/preset-env": "^7.15.6", "@babel/preset-react": "^7.14.5", - "@babel/runtime": "^7.15.3", + "@babel/runtime": "^7.15.4", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.3.2", + "autoprefixer": "^10.3.6", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "babel-plugin-import": "^1.13.3", - "clean-webpack-plugin": "^3.0.0", + "clean-webpack-plugin": "^4.0.0", "copy-webpack-plugin": "^9.0.1", - "css-loader": "^6.2.0", + "css-loader": "^6.3.0", "css-minimizer-webpack-plugin": "^3.0.2", - "dayjs": "^1.10.6", + "dayjs": "^1.10.7", "eslint": "^7.32.0", "eslint-loader": "^4.0.2", - "eslint-plugin-prettier": "^3.4.1", - "eslint-plugin-react": "^7.24.0", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-react": "^7.26.0", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", "favicons": "^6.2.2", @@ -71,22 +71,22 @@ "html-webpack-plugin": "^5.3.2", "less": "^4.1.1", "less-loader": "^10.0.1", - "mini-css-extract-plugin": "^2.2.0", + "mini-css-extract-plugin": "^2.3.0", "mockjs": "^1.1.0", - "postcss": "^8.3.6", + "postcss": "^8.3.8", "postcss-loader": "^6.1.1", - "prettier": "^2.3.2", - "style-loader": "^3.2.1", + "prettier": "^2.4.1", + "style-loader": "^3.3.0", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^5.1.4", + "terser-webpack-plugin": "^5.2.4", "url-loader": "^4.1.1", - "webpack": "^5.51.1", + "webpack": "^5.54.0", "webpack-bundle-analyzer": "^4.4.2", "webpack-cli": "^4.8.0", - "webpack-dev-middleware": "^5.0.0", - "webpack-hot-middleware": "^2.25.0", + "webpack-dev-middleware": "^5.2.1", + "webpack-hot-middleware": "^2.25.1", "webpackbar": "^4.0.0", - "workbox-webpack-plugin": "^6.2.4", + "workbox-webpack-plugin": "^6.3.0", "xml-loader": "^1.2.1" }, "browserslist": [ From 23143c46694d27b55fa641f419c040474f59aed4 Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Fri, 8 Oct 2021 09:35:38 +0800 Subject: [PATCH 83/98] update packages --- package.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index caca5c10..169a0e08 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "dependencies": { "@rematch/core": "^2.1.0", "antd": "^4.16.13", - "axios": "^0.21.4", - "core-js": "^3.18.0", + "axios": "^0.22.0", + "core-js": "^3.18.2", "history": "^4.10.1", "lodash": "^4.17.21", "react": "^17.0.2", @@ -37,31 +37,31 @@ "redux": "^4.1.1" }, "devDependencies": { - "@babel/core": "^7.15.5", + "@babel/core": "^7.15.8", "@babel/plugin-proposal-class-properties": "^7.14.5", - "@babel/plugin-proposal-decorators": "^7.15.4", + "@babel/plugin-proposal-decorators": "^7.15.8", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5", "@babel/plugin-proposal-object-rest-spread": "^7.15.6", "@babel/plugin-proposal-optional-chaining": "^7.14.5", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.15.0", - "@babel/preset-env": "^7.15.6", + "@babel/plugin-transform-runtime": "^7.15.8", + "@babel/preset-env": "^7.15.8", "@babel/preset-react": "^7.14.5", "@babel/runtime": "^7.15.4", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.3.6", + "autoprefixer": "^10.3.7", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "babel-plugin-import": "^1.13.3", "clean-webpack-plugin": "^4.0.0", "copy-webpack-plugin": "^9.0.1", "css-loader": "^6.3.0", - "css-minimizer-webpack-plugin": "^3.0.2", + "css-minimizer-webpack-plugin": "^3.1.1", "dayjs": "^1.10.7", "eslint": "^7.32.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-react": "^7.26.0", + "eslint-plugin-react": "^7.26.1", "eslint-plugin-react-hooks": "^4.2.0", "express": "^4.17.1", "favicons": "^6.2.2", @@ -69,20 +69,20 @@ "file-loader": "^6.2.0", "happypack": "^5.0.1", "html-webpack-plugin": "^5.3.2", - "less": "^4.1.1", + "less": "^4.1.2", "less-loader": "^10.0.1", - "mini-css-extract-plugin": "^2.3.0", + "mini-css-extract-plugin": "^2.4.2", "mockjs": "^1.1.0", - "postcss": "^8.3.8", + "postcss": "^8.3.9", "postcss-loader": "^6.1.1", "prettier": "^2.4.1", "style-loader": "^3.3.0", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.2.4", "url-loader": "^4.1.1", - "webpack": "^5.54.0", + "webpack": "^5.58.0", "webpack-bundle-analyzer": "^4.4.2", - "webpack-cli": "^4.8.0", + "webpack-cli": "^4.9.0", "webpack-dev-middleware": "^5.2.1", "webpack-hot-middleware": "^2.25.1", "webpackbar": "^4.0.0", From a483a878657c7f7cb02a21be107a33856bbcc3cd Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Wed, 13 Oct 2021 18:05:28 +0800 Subject: [PATCH 84/98] update packages --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 169a0e08..4a4fab8f 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "dependencies": { "@rematch/core": "^2.1.0", "antd": "^4.16.13", - "axios": "^0.22.0", - "core-js": "^3.18.2", + "axios": "^0.23.0", + "core-js": "^3.18.3", "history": "^4.10.1", "lodash": "^4.17.21", "react": "^17.0.2", @@ -55,7 +55,7 @@ "babel-plugin-import": "^1.13.3", "clean-webpack-plugin": "^4.0.0", "copy-webpack-plugin": "^9.0.1", - "css-loader": "^6.3.0", + "css-loader": "^6.4.0", "css-minimizer-webpack-plugin": "^3.1.1", "dayjs": "^1.10.7", "eslint": "^7.32.0", @@ -70,7 +70,7 @@ "happypack": "^5.0.1", "html-webpack-plugin": "^5.3.2", "less": "^4.1.2", - "less-loader": "^10.0.1", + "less-loader": "^10.1.0", "mini-css-extract-plugin": "^2.4.2", "mockjs": "^1.1.0", "postcss": "^8.3.9", @@ -80,8 +80,8 @@ "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.2.4", "url-loader": "^4.1.1", - "webpack": "^5.58.0", - "webpack-bundle-analyzer": "^4.4.2", + "webpack": "^5.58.2", + "webpack-bundle-analyzer": "^4.5.0", "webpack-cli": "^4.9.0", "webpack-dev-middleware": "^5.2.1", "webpack-hot-middleware": "^2.25.1", @@ -96,4 +96,4 @@ "not dead", "not op_mini all" ] -} \ No newline at end of file +} From ca4569eb5597b7468fef2227fb6f9425886825ed Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Thu, 28 Oct 2021 14:41:12 +0800 Subject: [PATCH 85/98] =?UTF-8?q?=E4=B8=8D=E5=86=8D=E9=9C=80=E8=A6=81file-?= =?UTF-8?q?loader=20/=20url-loader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 33 ++++++++++++++++----------------- src/index.js | 4 ++-- webpack.dev.config.js | 22 ++++------------------ webpack.production.config.js | 21 +++------------------ 4 files changed, 25 insertions(+), 55 deletions(-) diff --git a/package.json b/package.json index 4a4fab8f..de2cf407 100644 --- a/package.json +++ b/package.json @@ -23,18 +23,18 @@ "pnp": false }, "dependencies": { - "@rematch/core": "^2.1.0", + "@rematch/core": "^2.1.1", "antd": "^4.16.13", - "axios": "^0.23.0", - "core-js": "^3.18.3", + "axios": "^0.24.0", + "core-js": "^3.19.0", "history": "^4.10.1", "lodash": "^4.17.21", "react": "^17.0.2", "react-dom": "^17.0.2", "react-loadable": "^5.5.0", - "react-redux": "^7.2.5", + "react-redux": "^7.2.6", "react-router-dom": "^5.3.0", - "redux": "^4.1.1" + "redux": "^4.1.2" }, "devDependencies": { "@babel/core": "^7.15.8", @@ -51,11 +51,12 @@ "antd-dayjs-webpack-plugin": "^1.0.6", "autoprefixer": "^10.3.7", "babel-eslint": "^10.1.0", - "babel-loader": "^8.2.2", + "babel-loader": "^8.2.3", "babel-plugin-import": "^1.13.3", + "body-parser": "^1.19.0", "clean-webpack-plugin": "^4.0.0", "copy-webpack-plugin": "^9.0.1", - "css-loader": "^6.4.0", + "css-loader": "^6.5.0", "css-minimizer-webpack-plugin": "^3.1.1", "dayjs": "^1.10.7", "eslint": "^7.32.0", @@ -66,23 +67,21 @@ "express": "^4.17.1", "favicons": "^6.2.2", "favicons-webpack-plugin": "^5.0.2", - "file-loader": "^6.2.0", "happypack": "^5.0.1", - "html-webpack-plugin": "^5.3.2", + "html-webpack-plugin": "^5.5.0", "less": "^4.1.2", - "less-loader": "^10.1.0", - "mini-css-extract-plugin": "^2.4.2", + "less-loader": "^10.2.0", + "mini-css-extract-plugin": "^2.4.3", "mockjs": "^1.1.0", - "postcss": "^8.3.9", - "postcss-loader": "^6.1.1", + "postcss": "^8.3.11", + "postcss-loader": "^6.2.0", "prettier": "^2.4.1", - "style-loader": "^3.3.0", + "style-loader": "^3.3.1", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.2.4", - "url-loader": "^4.1.1", - "webpack": "^5.58.2", + "webpack": "^5.60.0", "webpack-bundle-analyzer": "^4.5.0", - "webpack-cli": "^4.9.0", + "webpack-cli": "^4.9.1", "webpack-dev-middleware": "^5.2.1", "webpack-hot-middleware": "^2.25.1", "webpackbar": "^4.0.0", diff --git a/src/index.js b/src/index.js index 1aa3f4a7..e9c8994a 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ /** APP入口 **/ -import "core-js/stable"; -import "regenerator-runtime/runtime"; +// import "core-js/stable"; +// import "regenerator-runtime/runtime"; import React from "react"; import ReactDOM from "react-dom"; diff --git a/webpack.dev.config.js b/webpack.dev.config.js index aa4ec5ed..2898f71e 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -19,6 +19,7 @@ module.exports = { path: __dirname + "/", // 将打包好的文件放在此路径下,dev模式中,只会在内存中存在,不会真正的打包到此路径 publicPath: PUBLIC_PATH, // 文件解析路径,index.html中引用的路径会被设置为相对于此路径 filename: "bundle-[contenthash].js", // 编译后的文件名字 + assetModuleFilename: "assets/[name].[hash:4][ext]", }, devtool: "eval-source-map", // 报错的时候在控制台输出哪一行报错 optimization: { @@ -63,28 +64,13 @@ module.exports = { // 文件解析 test: /\.(eot|woff|otf|svg|ttf|woff2|appcache|mp3|mp4|pdf)(\?|$)/, include: path.resolve(__dirname, "src"), - use: [ - { - loader: "file-loader", - options: { - name: "assets/[name].[hash:4].[ext]", - }, - }, - ], + type: "asset/resource", }, { // 图片解析 - test: /\.(png|jpg|jpeg|gif)$/i, + test: /\.(png|jpg|jpeg|gif)(\?|$)/i, include: path.resolve(__dirname, "src"), - use: [ - { - loader: "url-loader", - options: { - limit: 8192, - name: "assets/[name].[hash:4].[ext]", - }, - }, - ], + type: "asset", }, { // wasm文件解析 diff --git a/webpack.production.config.js b/webpack.production.config.js index 5d2b4bd5..a1fc7527 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -84,28 +84,13 @@ module.exports = { // 文件解析 test: /\.(eot|woff|otf|svg|ttf|woff2|appcache|mp3|mp4|pdf)(\?|$)/, include: path.resolve(__dirname, "src"), - use: [ - { - loader: "file-loader", - options: { - name: "assets/[name].[hash:4].[ext]", - }, - }, - ], + type: "asset/resource", }, { // 图片解析 - test: /\.(png|jpg|jpeg|gif)$/i, + test: /\.(png|jpg|jpeg|gif)(\?|$)/i, include: path.resolve(__dirname, "src"), - use: [ - { - loader: "url-loader", - options: { - limit: 8192, - name: "assets/[name].[hash:4].[ext]", - }, - }, - ], + type: "asset", }, { // wasm文件解析 From 98bb736d30c96845366398a017a2f4d47fb3bf42 Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Thu, 28 Oct 2021 14:48:22 +0800 Subject: [PATCH 86/98] =?UTF-8?q?=E4=B8=8D=E5=86=8D=E9=9C=80=E8=A6=81body-?= =?UTF-8?q?parser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index de2cf407..c9a38936 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "babel-eslint": "^10.1.0", "babel-loader": "^8.2.3", "babel-plugin-import": "^1.13.3", - "body-parser": "^1.19.0", "clean-webpack-plugin": "^4.0.0", "copy-webpack-plugin": "^9.0.1", "css-loader": "^6.5.0", From b9aaca194d2369eb1c8dc4682c25154a8fd205a4 Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Wed, 15 Dec 2021 19:10:44 +0800 Subject: [PATCH 87/98] update react-router v6 --- package.json | 10 +- src/component/menu/index.js | 35 ++++--- src/container/features/index.js | 14 +-- src/container/home/index.js | 20 ++-- src/container/notfound/index.js | 10 +- src/container/routers/index.js | 83 +++++++---------- src/container/test/index.js | 151 ++++++++++--------------------- src/container/testclass/index.js | 73 ++++----------- src/models/test.js | 13 +-- 9 files changed, 136 insertions(+), 273 deletions(-) diff --git a/package.json b/package.json index c9a38936..5e4e6a2b 100644 --- a/package.json +++ b/package.json @@ -27,13 +27,13 @@ "antd": "^4.16.13", "axios": "^0.24.0", "core-js": "^3.19.0", - "history": "^4.10.1", + "history": "^5.1.0", "lodash": "^4.17.21", "react": "^17.0.2", "react-dom": "^17.0.2", "react-loadable": "^5.5.0", "react-redux": "^7.2.6", - "react-router-dom": "^5.3.0", + "react-router-dom": "^6.1.1", "redux": "^4.1.2" }, "devDependencies": { @@ -54,7 +54,7 @@ "babel-loader": "^8.2.3", "babel-plugin-import": "^1.13.3", "clean-webpack-plugin": "^4.0.0", - "copy-webpack-plugin": "^9.0.1", + "copy-webpack-plugin": "^10.1.0", "css-loader": "^6.5.0", "css-minimizer-webpack-plugin": "^3.1.1", "dayjs": "^1.10.7", @@ -70,7 +70,7 @@ "html-webpack-plugin": "^5.5.0", "less": "^4.1.2", "less-loader": "^10.2.0", - "mini-css-extract-plugin": "^2.4.3", + "mini-css-extract-plugin": "^2.4.5", "mockjs": "^1.1.0", "postcss": "^8.3.11", "postcss-loader": "^6.2.0", @@ -83,7 +83,7 @@ "webpack-cli": "^4.9.1", "webpack-dev-middleware": "^5.2.1", "webpack-hot-middleware": "^2.25.1", - "webpackbar": "^4.0.0", + "webpackbar": "^5.0.2", "workbox-webpack-plugin": "^6.3.0", "xml-loader": "^1.2.1" }, diff --git a/src/component/menu/index.js b/src/component/menu/index.js index 202beb9d..4f047087 100644 --- a/src/component/menu/index.js +++ b/src/component/menu/index.js @@ -2,37 +2,34 @@ import React from "react"; import { Link } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import "./index.less"; export default function Menu() { + const navigate = useNavigate(); + + function goToTest() { + navigate("/test?a=123&b=abc", { state: { c: 456, d: "ABC" } }); + } + return ( diff --git a/src/container/features/index.js b/src/container/features/index.js index 3aa81fc8..9c837397 100644 --- a/src/container/features/index.js +++ b/src/container/features/index.js @@ -2,12 +2,11 @@ /** 所需的各种插件 **/ import React from "react"; -import { connect } from "react-redux"; /** 所需的所有资源 **/ import "./index.less"; -function FeaturesPageContainer(props) { +export default function FeaturesPageContainer(props) { return (

构建与特性

@@ -40,9 +39,7 @@ function FeaturesPageContainer(props) {

HMR局部热更新

-
- 使用webpack-dev-middleware 和 webpack-hot-middleware设置了热更新 -
+
使用webpack-dev-middleware 和 webpack-hot-middleware设置了热更新

代码分割

@@ -57,10 +54,3 @@ function FeaturesPageContainer(props) {
); } - -export default connect( - (state) => ({}), - (dispatch) => ({ - actions: {}, - }) -)(FeaturesPageContainer); diff --git a/src/container/home/index.js b/src/container/home/index.js index 064648b5..d14f6a15 100644 --- a/src/container/home/index.js +++ b/src/container/home/index.js @@ -2,31 +2,23 @@ /** 所需的各种插件 **/ import React from "react"; -import { connect } from "react-redux"; +import { useStore } from "react-redux"; /** 所需的各种资源 **/ import "./index.less"; import ImgLogo from "../../assets/react-logo.jpg"; -function HomePageContainer(props) { +export default function HomePageContainer(props) { + const store = useStore(); + console.log("store:", store); + console.log("what props:", props); return (
React-Luo
-
- react17、redux4、router5、webpack5、eslint、babel7、antd4 -
+
react17、redux4、router5、webpack5、eslint、babel7、antd4
); } - -export default connect( - (state) => { - return {}; - }, - (dispatch) => ({ - actions: {}, - }) -)(HomePageContainer); diff --git a/src/container/notfound/index.js b/src/container/notfound/index.js index 47f43214..21cc519f 100644 --- a/src/container/notfound/index.js +++ b/src/container/notfound/index.js @@ -2,22 +2,14 @@ /** 所需的各种插件 **/ import React from "react"; -import { connect } from "react-redux"; /** 所需的所有资源 **/ import "./index.less"; -function NotFoundPageContainer() { +export default function NotFoundPageContainer() { return (
404 not found
); } - -export default connect( - (state) => ({}), - (dispatch) => ({ - actions: {}, - }) -)(NotFoundPageContainer); diff --git a/src/container/routers/index.js b/src/container/routers/index.js index 6f17f0ec..5c826a64 100644 --- a/src/container/routers/index.js +++ b/src/container/routers/index.js @@ -2,14 +2,15 @@ /** 所需的各种插件 **/ import React, { useEffect } from "react"; -import { connect } from "react-redux"; -import { Router, Route, Switch, Redirect } from "react-router-dom"; + +// import { Router, Route, Switch, Redirect } from "react-router-dom"; +import { HashRouter as Router, Routes, Route, Navigate } from "react-router-dom"; // antd的多语言 import { ConfigProvider } from "antd"; import zhCN from "antd/lib/locale-provider/zh_CN"; -// import {createBrowserHistory as createHistory} from "history/"; // URL模式的history +// import { createBrowserHistory as createHistory } from "history/"; // URL模式的history import { createHashHistory as createHistory } from "history"; // 锚点模式的history import Loadable from "react-loadable"; // 用于代码分割时动态加载模块 @@ -31,8 +32,16 @@ const Test = Loadable({ loader: () => import(/* webpackChunkName:'test' */ "../test"), loading: Loading, }); -const TestClass = Loadable({ - loader: () => import(/* webpackChunkName:'testclass' */ "../testclass"), +const Page1 = Loadable({ + loader: () => import(/* webpackChunkName:'testclass' */ "../test/container/page1"), + loading: Loading, +}); +const Page2 = Loadable({ + loader: () => import(/* webpackChunkName:'testclass' */ "../test/container/page2"), + loading: Loading, +}); +const Page3 = Loadable({ + loader: () => import(/* webpackChunkName:'testclass' */ "../test/container/page3"), loading: Loading, }); const Features = Loadable({ @@ -47,70 +56,48 @@ const NotFound = Loadable({ const history = createHistory(); // 实例化history对象 /** 组件 **/ -function RootRouterContainer(props) { +export default function RootRouterContainer(props) { // 在组件加载完毕后触发 useEffect(() => { // 可以手动在此预加载指定的模块: - //Features.preload(); // 预加载Features页面 - //Test.preload(); // 预加载Test页面 + // Features.preload(); // 预加载Features页面 + // Test.preload(); // 预加载Test页面 // 也可以直接预加载所有的异步模块 // Loadable.preloadAll(); }, []); - /** 简单权限控制 **/ - function onEnter(Component, props) { + /** 简单权限控制 路由守卫 **/ + function onEnter(Component) { // 例子:如果没有登录,直接跳转至login页 // if (sessionStorage.getItem('userInfo')) { - // return ; + // return Component; // } else { // return ; // } - return ; + return Component; } return ( <> - { - return ( -
- - - onEnter(Home, props)} - /> - onEnter(Features, props)} - /> - onEnter(Test, props)} - /> - onEnter(TestClass, props)} - /> - - - -
- ); - }} - /> +
+ + } /> + )} /> + )} /> + )}> + )} /> + )} /> + )} /> + + } /> + + +
); } - -export default connect( - (state) => ({}), - (dispatch) => ({ - actions: {}, - }) -)(RootRouterContainer); diff --git a/src/container/test/index.js b/src/container/test/index.js index fb8f683d..8c7ee6e0 100644 --- a/src/container/test/index.js +++ b/src/container/test/index.js @@ -2,8 +2,8 @@ /** 所需的各种插件 **/ import React, { useState, useEffect } from "react"; -import { connect } from "react-redux"; -import { Route, Switch, Link } from "react-router-dom"; +import { useDispatch, useSelector } from "react-redux"; +import { useLocation, Link, Outlet } from "react-router-dom"; /** 所需的所有资源 **/ import { Modal, Form, Button, message, Input } from "antd"; @@ -12,29 +12,45 @@ import "./index.less"; import ImgTest from "../../assets/test.jpg"; import Mp3 from "../../assets/starSky.mp3"; -import Page1 from "./container/page1"; // 子页面1 -import Page2 from "./container/page2"; // 子页面2 -import Page3 from "./container/page3"; // 子页面3 /** 组件 **/ -function TestPageContainer({ - count, // 来自store - test model中的全局变量count - location, // 自动注入的location对象 - match, // 自动注入的match对象 - history, // 自动注入的history对象 - actions, // 上面model中定义的actions对象,自动成为this.props.actions变量 -}) { +export default function TestPageContainer() { + const dispatch = useDispatch(); + + const count = useSelector(state => state.test.count); // 引入test model中的count数据 + + const location = useLocation(); + console.log("location:=", location); + // 引入test model中的add + const onTestAdd = () => { + dispatch({ + type: "test/onTestAdd", + }); + }; + + // 引入test model中的fetch异步请求action + const serverFetch = async () => { + const res = await dispatch({ + type: "test/serverFetch", + }); + if (res.status === 200) { + setMokeFetch(res.data); + } else { + message.error("获取数据失败"); + } + }; + const [visible, setVisible] = useState(false); // 模态框隐藏和显示 const [mokeFetch, setMokeFetch] = useState([]); // 用于测试异步请求 - const [localCount, setLocalCount] = useState(0); // 数字 + const layout = { labelCol: { span: 8 }, wrapperCol: { span: 16 }, }; // 仅组件加载完毕时触发一次 - useEffect(() => { - console.log("所有页面默认拥有的3个对象:", location, match, history); + useEffect(async () => { + // console.log("所有页面默认拥有的3个对象:", location, match, history); const set = new Set([1, 2, 3]); const map = new Map(); console.log("Set 和 Map 测试:", set, map); @@ -44,35 +60,10 @@ function TestPageContainer({ console.log("obj的扩展运算符测试:", b); // 获取用户信息测试 - actions - .getUserinfo({ id: 1 }) - .then((res) => { - console.log("获取用户信息测试:", res); - }) - .catch(() => { - console.log("Promise catch"); - }) - .finally(() => { - console.log("Promise finally"); - }); + const userInfo = await dispatch({ type: "app/getUserinfo", payload: { id: 1 } }); + console.log("获取到userInfo:", userInfo); }, []); - // 当props.count改变时触发 - useEffect(() => { - setLocalCount(count); - }, [count]); - - // Fetch测试按钮点击时触发 - function onFetchClick() { - actions.serverFetch().then((res) => { - if (res.status === 200) { - setMokeFetch(res.data); - } else { - message.error("获取数据失败"); - } - }); - } - // 表单提交且验证通过时触发 function handleSubmit(e) { message.success("执行了登录操作"); @@ -89,17 +80,11 @@ function TestPageContainer({ 上方图片,一张是img,一张是background
- - 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", - + 请特别注意,现在webpack.production.config.js中的publicPath配置为"/",
- - 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 - + 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题
- - 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" - + 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/"

@@ -133,23 +118,11 @@ function TestPageContainer({

Antd表单

- + } placeholder="用户名" /> - - } - placeholder="密码" - /> + + } placeholder="密码" />

action测试

-
store中数据num: - {localCount} + {count}

异步请求测试(Mock模拟数据)

-
@@ -205,41 +174,17 @@ function TestPageContainer({

嵌套路由测试

+ 第一页 + 第二页 + 第三页
- 子页1 - 子页2 - 子页3 - - - - - - +
- setVisible(false)} - onCancel={() => setVisible(false)} - > + setVisible(false)} onCancel={() => setVisible(false)}>

内容...

); } - -export default connect( - (state) => ({ - userinfo: state.app.userinfo, // 引入app model中的userinfo数据 - count: state.test.count, // 引入test model中的count数据 - }), - (dispatch) => ({ - actions: { - getUserinfo: dispatch.app.getUserinfo, // 引入app model中的获取用户信息action - onTestAdd: dispatch.test.onTestAdd, // 引入test model中的数字+1 action - serverFetch: dispatch.test.serverFetch, // 引入test model中的fetch异步请求action - }, - }) -)(TestPageContainer); diff --git a/src/container/testclass/index.js b/src/container/testclass/index.js index f3c58000..381d68dd 100644 --- a/src/container/testclass/index.js +++ b/src/container/testclass/index.js @@ -3,7 +3,7 @@ /** 所需的各种插件 **/ import React from "react"; import { connect } from "react-redux"; -import { Route, Switch, Link } from "react-router-dom"; +import { Routes, Route, Link } from "react-router-dom"; import P from "prop-types"; /** 所需的所有资源 **/ @@ -39,12 +39,7 @@ class TestClassPageContainer extends React.Component { /** react生命周期 - 组件初始化完毕DOM挂载完毕后 触发1次 **/ componentDidMount() { - console.log( - "所有页面默认拥有的3个对象:", - this.props.location, - this.props.match, - this.props.history - ); + console.log("所有页面默认拥有的3个对象:", this.props.location, this.props.match, this.props.history); const set = new Set([1, 2, 3]); const map = new Map(); console.log("Set 和 Map 测试:", set, map); @@ -56,7 +51,7 @@ class TestClassPageContainer extends React.Component { // 获取用户信息测试 this.props.actions .getUserinfo({ id: 1 }) - .then((res) => { + .then(res => { console.log("获取用户信息测试:", res); }) .catch(() => { @@ -143,7 +138,7 @@ class TestClassPageContainer extends React.Component { // Fetch测试按钮点击时触发 onFetchClick() { - this.props.actions.serverFetch().then((res) => { + this.props.actions.serverFetch().then(res => { if (res.status === 200) { this.setState({ mokeFetch: res.data, @@ -166,17 +161,11 @@ class TestClassPageContainer extends React.Component { 上方图片,一张是img,一张是background
- - 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", - + 请特别注意,现在webpack.production.config.js中的publicPath配置为"/",
- - 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 - + 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题
- - 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" - + 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/"

@@ -218,7 +207,7 @@ class TestClassPageContainer extends React.Component { state参数: {this.props.location.state ? Object.entries(this.props.location.state) - .map((v) => `${v[0]}=${v[1]}`) + .map(v => `${v[0]}=${v[1]}`) .join(",") : ""}

@@ -227,10 +216,7 @@ class TestClassPageContainer extends React.Component {

action测试

-
@@ -259,37 +245,16 @@ class TestClassPageContainer extends React.Component { 子页1 子页2 子页3 - - - - - - + + + + + +

- this.handleCancel()} - onCancel={() => this.handleCancel()} - > + this.handleCancel()} onCancel={() => this.handleCancel()}>

内容...

@@ -298,15 +263,15 @@ class TestClassPageContainer extends React.Component { } export default connect( - (state) => ({ + state => ({ userinfo: state.app.userinfo, // 引入app model中的userinfo数据 count: state.test.count, // 引入test model中的count数据 }), - (model) => ({ + model => ({ actions: { getUserinfo: model.app.getUserinfo, // 引入app model中的获取用户信息action onTestAdd: model.test.onTestAdd, // 引入test model中的数字+1 action serverFetch: model.test.serverFetch, // 引入test model中的fetch异步请求action }, - }) + }), )(TestClassPageContainer); diff --git a/src/models/test.js b/src/models/test.js index 4aaf9de7..2351340a 100644 --- a/src/models/test.js +++ b/src/models/test.js @@ -22,21 +22,16 @@ export default { }, /** actions **/ - effects: (dispatch) => ({ + effects: dispatch => ({ // 测试 - 数字加1 - onTestAdd(params) { - this.setCount(params + 1); // 这里会指向上面reducers中的setCount + onTestAdd(params, rootState) { + this.setCount(rootState.test.count + 1); //. 这里会指向上面reducers中的setCount }, // 测试 - 异步请求 async serverFetch(params = {}) { try { - const res = await Server( - "/api/url.ajax", - null, - { a: 123, b: "456" }, - "POST" - ); + const res = await Server("/api/url.ajax", null, { a: 123, b: "456" }, "POST"); if (res && res.data.status === 200) { dispatch({ type: "test/setFetchValue", payload: res.data.data }); // test/setFetchValue对应上面reducers中的setFetchValue } From 14385572b8d8caa752d91f23e71cc6abf117f48e Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Wed, 15 Dec 2021 19:16:49 +0800 Subject: [PATCH 88/98] update: pacakges --- package.json | 53 ++-- src/component/menu/index.js | 9 +- src/container/features/index.js | 4 +- src/container/home/index.js | 4 +- src/container/routers/index.js | 16 +- src/container/test/container/page1.js | 11 +- src/container/test/container/page2.js | 11 +- src/container/test/container/page3.js | 11 +- src/container/test/index.js | 44 ++- src/container/testclass/container/page1.js | 27 -- src/container/testclass/container/page2.js | 27 -- src/container/testclass/container/page3.js | 27 -- src/container/testclass/index.js | 277 ------------------ src/container/testclass/index.less | 53 ---- src/models/test.js | 9 +- ...35\350\265\226\346\270\205\345\215\225.md" | 1 - 16 files changed, 96 insertions(+), 488 deletions(-) delete mode 100644 src/container/testclass/container/page1.js delete mode 100644 src/container/testclass/container/page2.js delete mode 100644 src/container/testclass/container/page3.js delete mode 100644 src/container/testclass/index.js delete mode 100644 src/container/testclass/index.less diff --git a/package.json b/package.json index 5e4e6a2b..055d30de 100644 --- a/package.json +++ b/package.json @@ -23,11 +23,11 @@ "pnp": false }, "dependencies": { - "@rematch/core": "^2.1.1", - "antd": "^4.16.13", + "@rematch/core": "^2.2.0", + "antd": "^4.17.3", "axios": "^0.24.0", - "core-js": "^3.19.0", - "history": "^5.1.0", + "core-js": "^3.19.3", + "eslint": "^7.32.0", "lodash": "^4.17.21", "react": "^17.0.2", "react-dom": "^17.0.2", @@ -37,32 +37,31 @@ "redux": "^4.1.2" }, "devDependencies": { - "@babel/core": "^7.15.8", - "@babel/plugin-proposal-class-properties": "^7.14.5", - "@babel/plugin-proposal-decorators": "^7.15.8", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5", - "@babel/plugin-proposal-object-rest-spread": "^7.15.6", - "@babel/plugin-proposal-optional-chaining": "^7.14.5", + "@babel/core": "^7.16.5", + "@babel/plugin-proposal-class-properties": "^7.16.5", + "@babel/plugin-proposal-decorators": "^7.16.5", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.5", + "@babel/plugin-proposal-object-rest-spread": "^7.16.5", + "@babel/plugin-proposal-optional-chaining": "^7.16.5", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.15.8", - "@babel/preset-env": "^7.15.8", - "@babel/preset-react": "^7.14.5", - "@babel/runtime": "^7.15.4", + "@babel/plugin-transform-runtime": "^7.16.5", + "@babel/preset-env": "^7.16.5", + "@babel/preset-react": "^7.16.5", + "@babel/runtime": "^7.16.5", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.3.7", + "autoprefixer": "^10.4.0", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.3", "babel-plugin-import": "^1.13.3", "clean-webpack-plugin": "^4.0.0", "copy-webpack-plugin": "^10.1.0", - "css-loader": "^6.5.0", - "css-minimizer-webpack-plugin": "^3.1.1", + "css-loader": "^6.5.1", + "css-minimizer-webpack-plugin": "^3.2.0", "dayjs": "^1.10.7", - "eslint": "^7.32.0", "eslint-loader": "^4.0.2", "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-react": "^7.26.1", - "eslint-plugin-react-hooks": "^4.2.0", + "eslint-plugin-react": "^7.27.1", + "eslint-plugin-react-hooks": "^4.3.0", "express": "^4.17.1", "favicons": "^6.2.2", "favicons-webpack-plugin": "^5.0.2", @@ -72,19 +71,19 @@ "less-loader": "^10.2.0", "mini-css-extract-plugin": "^2.4.5", "mockjs": "^1.1.0", - "postcss": "^8.3.11", - "postcss-loader": "^6.2.0", - "prettier": "^2.4.1", + "postcss": "^8.4.5", + "postcss-loader": "^6.2.1", + "prettier": "^2.5.1", "style-loader": "^3.3.1", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^5.2.4", - "webpack": "^5.60.0", + "terser-webpack-plugin": "^5.2.5", + "webpack": "^5.65.0", "webpack-bundle-analyzer": "^4.5.0", "webpack-cli": "^4.9.1", - "webpack-dev-middleware": "^5.2.1", + "webpack-dev-middleware": "^5.2.2", "webpack-hot-middleware": "^2.25.1", "webpackbar": "^5.0.2", - "workbox-webpack-plugin": "^6.3.0", + "workbox-webpack-plugin": "^6.4.2", "xml-loader": "^1.2.1" }, "browserslist": [ diff --git a/src/component/menu/index.js b/src/component/menu/index.js index 4f047087..b3c81393 100644 --- a/src/component/menu/index.js +++ b/src/component/menu/index.js @@ -25,11 +25,16 @@ export default function Menu() { pathname: "/test", search: "?a=123&b=abc", }} - state={{ c: 456, d: "ABC" }}> + state={{ c: 456, d: "ABC" }} + > 测试:api跳转
| - + GitHub diff --git a/src/container/features/index.js b/src/container/features/index.js index 9c837397..54b8ebe8 100644 --- a/src/container/features/index.js +++ b/src/container/features/index.js @@ -39,7 +39,9 @@ export default function FeaturesPageContainer(props) {

HMR局部热更新

-
使用webpack-dev-middleware 和 webpack-hot-middleware设置了热更新
+
+ 使用webpack-dev-middleware 和 webpack-hot-middleware设置了热更新 +

代码分割

diff --git a/src/container/home/index.js b/src/container/home/index.js index d14f6a15..01ffb1d3 100644 --- a/src/container/home/index.js +++ b/src/container/home/index.js @@ -17,7 +17,9 @@ export default function HomePageContainer(props) {
React-Luo
-
react17、redux4、router5、webpack5、eslint、babel7、antd4
+
+ react17、redux4、router5、webpack5、eslint、babel7、antd4 +
); diff --git a/src/container/routers/index.js b/src/container/routers/index.js index 5c826a64..d849ad4a 100644 --- a/src/container/routers/index.js +++ b/src/container/routers/index.js @@ -4,7 +4,12 @@ import React, { useEffect } from "react"; // import { Router, Route, Switch, Redirect } from "react-router-dom"; -import { HashRouter as Router, Routes, Route, Navigate } from "react-router-dom"; +import { + HashRouter as Router, + Routes, + Route, + Navigate, +} from "react-router-dom"; // antd的多语言 import { ConfigProvider } from "antd"; @@ -33,15 +38,18 @@ const Test = Loadable({ loading: Loading, }); const Page1 = Loadable({ - loader: () => import(/* webpackChunkName:'testclass' */ "../test/container/page1"), + loader: () => + import(/* webpackChunkName:'testclass' */ "../test/container/page1"), loading: Loading, }); const Page2 = Loadable({ - loader: () => import(/* webpackChunkName:'testclass' */ "../test/container/page2"), + loader: () => + import(/* webpackChunkName:'testclass' */ "../test/container/page2"), loading: Loading, }); const Page3 = Loadable({ - loader: () => import(/* webpackChunkName:'testclass' */ "../test/container/page3"), + loader: () => + import(/* webpackChunkName:'testclass' */ "../test/container/page3"), loading: Loading, }); const Features = Loadable({ diff --git a/src/container/test/container/page1.js b/src/container/test/container/page1.js index ec99b230..0ac8e923 100644 --- a/src/container/test/container/page1.js +++ b/src/container/test/container/page1.js @@ -1,14 +1,5 @@ import React from "react"; -import { connect } from "react-redux"; -import { bindActionCreators } from "redux"; -function Page1(props) { +export default function Page1(props) { return
A 子container 1
; } - -export default connect( - (state) => ({}), - (dispatch) => ({ - actions: bindActionCreators({}, dispatch), - }) -)(Page1); diff --git a/src/container/test/container/page2.js b/src/container/test/container/page2.js index 4851157c..e95b9c8b 100644 --- a/src/container/test/container/page2.js +++ b/src/container/test/container/page2.js @@ -1,14 +1,5 @@ import React from "react"; -import { connect } from "react-redux"; -import { bindActionCreators } from "redux"; -function Page2(props) { +export default function Page2(props) { return
B 子container 2
; } - -export default connect( - (state) => ({}), - (dispatch) => ({ - actions: bindActionCreators({}, dispatch), - }) -)(Page2); diff --git a/src/container/test/container/page3.js b/src/container/test/container/page3.js index 842faa96..230eebfb 100644 --- a/src/container/test/container/page3.js +++ b/src/container/test/container/page3.js @@ -1,14 +1,5 @@ import React from "react"; -import { connect } from "react-redux"; -import { bindActionCreators } from "redux"; -function Page3(props) { +export default function Page3(props) { return
C 子container 3
; } - -export default connect( - (state) => ({}), - (dispatch) => ({ - actions: bindActionCreators({}, dispatch), - }) -)(Page3); diff --git a/src/container/test/index.js b/src/container/test/index.js index 8c7ee6e0..eb8cba3c 100644 --- a/src/container/test/index.js +++ b/src/container/test/index.js @@ -17,7 +17,7 @@ import Mp3 from "../../assets/starSky.mp3"; export default function TestPageContainer() { const dispatch = useDispatch(); - const count = useSelector(state => state.test.count); // 引入test model中的count数据 + const count = useSelector((state) => state.test.count); // 引入test model中的count数据 const location = useLocation(); console.log("location:=", location); @@ -60,7 +60,10 @@ export default function TestPageContainer() { console.log("obj的扩展运算符测试:", b); // 获取用户信息测试 - const userInfo = await dispatch({ type: "app/getUserinfo", payload: { id: 1 } }); + const userInfo = await dispatch({ + type: "app/getUserinfo", + payload: { id: 1 }, + }); console.log("获取到userInfo:", userInfo); }, []); @@ -80,11 +83,17 @@ export default function TestPageContainer() { 上方图片,一张是img,一张是background
- 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", + + 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", +
- 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 + + 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 +
- 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" + + 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" +

@@ -118,11 +127,23 @@ export default function TestPageContainer() {

Antd表单

- + } placeholder="用户名" /> - - } placeholder="密码" /> + + } + placeholder="密码" + />
- setVisible(false)} onCancel={() => setVisible(false)}> + setVisible(false)} + onCancel={() => setVisible(false)} + >

内容...

diff --git a/src/container/testclass/container/page1.js b/src/container/testclass/container/page1.js deleted file mode 100644 index b1c9f235..00000000 --- a/src/container/testclass/container/page1.js +++ /dev/null @@ -1,27 +0,0 @@ -import React from "react"; -import { connect } from "react-redux"; -import { bindActionCreators } from "redux"; -import P from "prop-types"; - -class Page1 extends React.Component { - static propTypes = { - location: P.any, - history: P.any, - }; - - constructor(props) { - super(props); - this.state = {}; - } - - render() { - return
A 子container 1
; - } -} - -export default connect( - (state) => ({}), - (dispatch) => ({ - actions: bindActionCreators({}, dispatch), - }) -)(Page1); diff --git a/src/container/testclass/container/page2.js b/src/container/testclass/container/page2.js deleted file mode 100644 index 97d0b92c..00000000 --- a/src/container/testclass/container/page2.js +++ /dev/null @@ -1,27 +0,0 @@ -import React from "react"; -import { connect } from "react-redux"; -import { bindActionCreators } from "redux"; -import P from "prop-types"; - -class Page2 extends React.Component { - static propTypes = { - location: P.any, - history: P.any, - }; - - constructor(props) { - super(props); - this.state = {}; - } - - render() { - return
B 子container 2
; - } -} - -export default connect( - (state) => ({}), - (dispatch) => ({ - actions: bindActionCreators({}, dispatch), - }) -)(Page2); diff --git a/src/container/testclass/container/page3.js b/src/container/testclass/container/page3.js deleted file mode 100644 index 6cffb101..00000000 --- a/src/container/testclass/container/page3.js +++ /dev/null @@ -1,27 +0,0 @@ -import React from "react"; -import { connect } from "react-redux"; -import { bindActionCreators } from "redux"; -import P from "prop-types"; - -class Page3 extends React.Component { - static propTypes = { - location: P.any, - history: P.any, - }; - - constructor(props) { - super(props); - this.state = {}; - } - - render() { - return
C 子container 3
; - } -} - -export default connect( - (state) => ({}), - (dispatch) => ({ - actions: bindActionCreators({}, dispatch), - }) -)(Page3); diff --git a/src/container/testclass/index.js b/src/container/testclass/index.js deleted file mode 100644 index 381d68dd..00000000 --- a/src/container/testclass/index.js +++ /dev/null @@ -1,277 +0,0 @@ -/** 测试页 **/ - -/** 所需的各种插件 **/ -import React from "react"; -import { connect } from "react-redux"; -import { Routes, Route, Link } from "react-router-dom"; -import P from "prop-types"; - -/** 所需的所有资源 **/ -import { Modal, Form, Button, message } from "antd"; -import "./index.less"; - -import ImgTest from "../../assets/test.jpg"; -import Mp3 from "../../assets/starSky.mp3"; -import Page1 from "./container/page1"; // 子页面1 -import Page2 from "./container/page2"; // 子页面2 -import Page3 from "./container/page3"; // 子页面3 - -/** 组件 **/ -class TestClassPageContainer extends React.Component { - static propTypes = { - count: P.number, // 来自store - test model中的全局变量count - location: P.any, // 自动注入的location对象 - match: P.any, // 自动注入的match对象 - history: P.any, // 自动注入的history对象 - actions: P.object, // 上面model中定义的actions对象,自动成为this.props.actions变量 - }; - - /** react生命周期 - 构造函数 **/ - constructor(props) { - super(props); - this.state = { - visible: false, // 模态框隐藏和显示 - mokeFetch: [], // 用于测试fetch请求 - mokeAjax: [], // 用于测试ajax请求 - count: 0, // 数字 - }; - } - - /** react生命周期 - 组件初始化完毕DOM挂载完毕后 触发1次 **/ - componentDidMount() { - console.log("所有页面默认拥有的3个对象:", this.props.location, this.props.match, this.props.history); - const set = new Set([1, 2, 3]); - const map = new Map(); - console.log("Set 和 Map 测试:", set, map); - - const a = { a: 1, b: 2, c: 3 }; - const b = { d: 4, ...a }; - console.log("obj的扩展运算符测试:", b); - - // 获取用户信息测试 - this.props.actions - .getUserinfo({ id: 1 }) - .then(res => { - console.log("获取用户信息测试:", res); - }) - .catch(() => { - console.log("Promise catch"); - }) - .finally(() => { - console.log("Promise finally"); - }); - } - - /** - * react生命周期 - 是否执行下一次render - * 当有props或state改变时,可手动决定是否更新 - * @param nextProps 下一轮最新的props对象 - * @param nextState 下一轮最新的state对象 - * @returns {boolean} 返回true表示更新,返回false表示跳过本次render - */ - shoudComponentUpdate(nextProps, nextState) { - return true; - } - - /** - * react生命周期 - props改变时触发 - * @param nextProps 下一轮最新的props对象 - * @param nowState 当前的最新state对象 - * @returns {object} 返回一个对象或null,如果返回对象将自动覆盖this.state中对应的值 - */ - static getDerivedStateFromProps(nextProps, nowState) { - if (nextProps.count !== nowState.count) { - return { - count: nextProps.count, - }; - } - return null; - } - - /** react生命周期 - * 在下一轮render即将开始时触发,比componentWillUpdate后执行 - * 即合并了所有的this.setState操作,最后真正要开始render时触发 - * 不应该在这里调用this.setState,会进入死循环 - * @param prevProps 上一次的props,已经不是最新的值了 - * @param prevState 上一次的state,已经不是最新的值了 - * @returns {any} 返回值将作为componentDidUpdate的第3个参数传入 - * **/ - getSnapshotBeforeUpdate(prevProps, prevState) { - return null; - } - - /** - * react生命周期 - 每次组件的props参数或state参数改变引起重新render完成后,触发1次 - * @param prevProps 上一次的props,已经不是最新的值了 - * @param prevState 上一次的state,已经不是最新的值了 - */ - componentDidUpdate(prevProps, prevState) {} - - /** - * react生命周期 - 每次当前组件下的子组件中有任何报错时,触发1次 - * 这个方法比componentDidCatch先调用,在state更新之前调用 - * 所以可以在这个方法里改变state值,以显示给用户错误的提示而不会有空窗期 - * @param error 报的是什么错 - */ - static getDerivedStateFromError(error, info) {} - - /** - * react生命周期 - 每次当前组件下的子组件中有任何报错时,触发1次 - * @param error 报的是什么错 - * @param info 错误的触发记录,会显示代码哪一行报的错 - */ - componentDidCatch(error, info) {} - - // 打开模态框按钮被点击时触发 - onBtnClick() { - this.setState({ - visible: true, - }); - } - - // 关闭模态框 - handleCancel() { - this.setState({ - visible: false, - }); - } - - // Fetch测试按钮点击时触发 - onFetchClick() { - this.props.actions.serverFetch().then(res => { - if (res.status === 200) { - this.setState({ - mokeFetch: res.data, - }); - } else { - message.error("获取数据失败"); - } - }); - } - - render() { - return ( -
-

功能测试

-
-
-

引入图片

-

- - - 上方图片,一张是img,一张是background -
- 请特别注意,现在webpack.production.config.js中的publicPath配置为"/", -
- 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题 -
- 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/" -

-
-
-

引入其他种类的资源

-

-

-
-
-

LESS测试

-

- 来自LESS样式 -

-
-
-

Antd组件测试

-

- -   - -   - -   -

-
-
-

location对象测试

-

- 当前路由: - {this.props.location.pathname} -
- search参数: - {this.props.location.search} -
- state参数: - {this.props.location.state - ? Object.entries(this.props.location.state) - .map(v => `${v[0]}=${v[1]}`) - .join(",") - : ""} -

-

所有页面都自动被注入location、match、history对象

-
-
-

action测试

-

- -
- store中数据num: - {this.state.count} -

-
-
-

异步请求测试(Mock模拟数据)

-
- -
- 数据: -
    - {this.state.mokeFetch.map((item, index) => ( -
  • {`id: ${item.id}, email: ${item.email}`}
  • - ))} -
-
-
-
-

嵌套路由测试

-
- 子页1 - 子页2 - 子页3 - - - - - - -
-
-
- this.handleCancel()} onCancel={() => this.handleCancel()}> -

内容...

-
-
- ); - } -} - -export default connect( - state => ({ - userinfo: state.app.userinfo, // 引入app model中的userinfo数据 - count: state.test.count, // 引入test model中的count数据 - }), - model => ({ - actions: { - getUserinfo: model.app.getUserinfo, // 引入app model中的获取用户信息action - onTestAdd: model.test.onTestAdd, // 引入test model中的数字+1 action - serverFetch: model.test.serverFetch, // 引入test model中的fetch异步请求action - }, - }), -)(TestClassPageContainer); diff --git a/src/container/testclass/index.less b/src/container/testclass/index.less deleted file mode 100644 index 1abb7753..00000000 --- a/src/container/testclass/index.less +++ /dev/null @@ -1,53 +0,0 @@ -.page-test-class { - width: 100%; - max-width: 1200px; - margin: 0 auto; - padding: 40px; - letter-spacing: 1px; - .box { - margin-top: 40px; - .list { - margin-bottom: 20px; - .backImage { - display: block; - background-image: url(../../assets/test.jpg); - margin-top: 8px; - width: 326px; - height: 150px; - max-width: 100%; - } - p { - font-size: 14px; - padding: 5px 10px; - margin: 10px 0; - background-color: #eeeeff; - img { - max-width: 100%; - max-height: 150px; - } - audio { - display: block; - max-width: 100%; - } - } - div { - color: #888; - font-size: 12px; - } - } - .sonTest { - a { - margin-right: 5px; - } - } - } - .pbox { - font-size: 14px; - padding: 5px 10px; - margin: 10px 0; - background-color: #eeeeff; - } -} -:global(.son) { - padding: 20px; -} diff --git a/src/models/test.js b/src/models/test.js index 2351340a..7eb6c14d 100644 --- a/src/models/test.js +++ b/src/models/test.js @@ -22,7 +22,7 @@ export default { }, /** actions **/ - effects: dispatch => ({ + effects: (dispatch) => ({ // 测试 - 数字加1 onTestAdd(params, rootState) { this.setCount(rootState.test.count + 1); //. 这里会指向上面reducers中的setCount @@ -31,7 +31,12 @@ export default { // 测试 - 异步请求 async serverFetch(params = {}) { try { - const res = await Server("/api/url.ajax", null, { a: 123, b: "456" }, "POST"); + const res = await Server( + "/api/url.ajax", + null, + { a: 123, b: "456" }, + "POST" + ); if (res && res.data.status === 200) { dispatch({ type: "test/setFetchValue", payload: res.data.data }); // test/setFetchValue对应上面reducers中的setFetchValue } diff --git "a/\344\276\235\350\265\226\346\270\205\345\215\225.md" "b/\344\276\235\350\265\226\346\270\205\345\215\225.md" index 2bcd5abf..e318642a 100644 --- "a/\344\276\235\350\265\226\346\270\205\345\215\225.md" +++ "b/\344\276\235\350\265\226\346\270\205\345\215\225.md" @@ -28,7 +28,6 @@ "antd": "^3.4.1", // 蚂蚁金服UI组件库 "axios": "^0.18.0", // 封装了fetch的异步请求库 "core-js": "^3.1.4", // 代替babel-polyfill,使浏览器支持ES6+新功能 - "history": "^4.7.2", // 第3方history库,项目中没有使用react-router自带的 "lodash": "^4.17.5", // 常用工具库(深拷贝等) "moment": "^2.22.1", // 时间对象,antd用的这个,实际开发中可能会用到 "react": "^16.3.2", // react核心 From f6d3f935d31a6b5b2f2fd72150a0e14f75f98252 Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Wed, 15 Dec 2021 19:18:29 +0800 Subject: [PATCH 89/98] update --- src/container/home/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/container/home/index.js b/src/container/home/index.js index 01ffb1d3..c362bbce 100644 --- a/src/container/home/index.js +++ b/src/container/home/index.js @@ -18,7 +18,7 @@ export default function HomePageContainer(props) {
React-Luo
- react17、redux4、router5、webpack5、eslint、babel7、antd4 + react17、redux4、router6、webpack5、eslint、babel7、antd4
From 67276f14f5a92f96f5906d70534d14944b965c9b Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Sat, 5 Feb 2022 11:05:37 +0800 Subject: [PATCH 90/98] update: packages/eslint --- .eslintrc.json | 2 +- package.json | 60 ++++++++++++++++----------------- src/component/menu/index.js | 10 ++---- src/component/menu/index.less | 4 ++- src/container/features/index.js | 6 ++-- webpack.dev.config.js | 11 +++--- webpack.production.config.js | 4 +++ 7 files changed, 47 insertions(+), 50 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index bd28ac5f..c964754c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,7 +5,7 @@ "es6": true, "mocha": true }, - "parser": "babel-eslint", + "parser": "@babel/eslint-parser", "parserOptions": { "ecmaVersion": 9, "ecmaFeatures": { diff --git a/package.json b/package.json index 055d30de..75884dd8 100644 --- a/package.json +++ b/package.json @@ -24,63 +24,63 @@ }, "dependencies": { "@rematch/core": "^2.2.0", - "antd": "^4.17.3", - "axios": "^0.24.0", - "core-js": "^3.19.3", - "eslint": "^7.32.0", + "antd": "^4.18.5", + "axios": "^0.25.0", + "core-js": "^3.21.0", "lodash": "^4.17.21", "react": "^17.0.2", "react-dom": "^17.0.2", "react-loadable": "^5.5.0", "react-redux": "^7.2.6", - "react-router-dom": "^6.1.1", + "react-router-dom": "^6.2.1", "redux": "^4.1.2" }, "devDependencies": { - "@babel/core": "^7.16.5", - "@babel/plugin-proposal-class-properties": "^7.16.5", - "@babel/plugin-proposal-decorators": "^7.16.5", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.5", - "@babel/plugin-proposal-object-rest-spread": "^7.16.5", - "@babel/plugin-proposal-optional-chaining": "^7.16.5", + "@babel/core": "^7.17.0", + "@babel/eslint-parser": "^7.17.0", + "@babel/plugin-proposal-class-properties": "^7.16.7", + "@babel/plugin-proposal-decorators": "^7.17.0", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", + "@babel/plugin-proposal-object-rest-spread": "^7.16.7", + "@babel/plugin-proposal-optional-chaining": "^7.16.7", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.16.5", - "@babel/preset-env": "^7.16.5", - "@babel/preset-react": "^7.16.5", - "@babel/runtime": "^7.16.5", + "@babel/plugin-transform-runtime": "^7.17.0", + "@babel/preset-env": "^7.16.11", + "@babel/preset-react": "^7.16.7", + "@babel/runtime": "^7.17.0", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.4.0", - "babel-eslint": "^10.1.0", + "autoprefixer": "^10.4.2", "babel-loader": "^8.2.3", "babel-plugin-import": "^1.13.3", "clean-webpack-plugin": "^4.0.0", - "copy-webpack-plugin": "^10.1.0", - "css-loader": "^6.5.1", - "css-minimizer-webpack-plugin": "^3.2.0", + "copy-webpack-plugin": "^10.2.4", + "css-loader": "^6.6.0", + "css-minimizer-webpack-plugin": "^3.4.1", "dayjs": "^1.10.7", - "eslint-loader": "^4.0.2", + "eslint": "^8.8.0", "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-react": "^7.27.1", + "eslint-plugin-react": "^7.28.0", "eslint-plugin-react-hooks": "^4.3.0", - "express": "^4.17.1", + "eslint-webpack-plugin": "^3.0.1", + "express": "^4.17.2", "favicons": "^6.2.2", "favicons-webpack-plugin": "^5.0.2", "happypack": "^5.0.1", "html-webpack-plugin": "^5.5.0", "less": "^4.1.2", "less-loader": "^10.2.0", - "mini-css-extract-plugin": "^2.4.5", + "mini-css-extract-plugin": "^2.5.3", "mockjs": "^1.1.0", - "postcss": "^8.4.5", + "postcss": "^8.4.6", "postcss-loader": "^6.2.1", "prettier": "^2.5.1", "style-loader": "^3.3.1", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^5.2.5", - "webpack": "^5.65.0", + "terser-webpack-plugin": "^5.3.1", + "webpack": "^5.68.0", "webpack-bundle-analyzer": "^4.5.0", - "webpack-cli": "^4.9.1", - "webpack-dev-middleware": "^5.2.2", + "webpack-cli": "^4.9.2", + "webpack-dev-middleware": "^5.3.1", "webpack-hot-middleware": "^2.25.1", "webpackbar": "^5.0.2", "workbox-webpack-plugin": "^6.4.2", @@ -93,4 +93,4 @@ "not dead", "not op_mini all" ] -} +} \ No newline at end of file diff --git a/src/component/menu/index.js b/src/component/menu/index.js index b3c81393..3ce03b7d 100644 --- a/src/component/menu/index.js +++ b/src/component/menu/index.js @@ -20,21 +20,17 @@ export default function Menu() { | goToTest()} to={{ pathname: "/test", search: "?a=123&b=abc", }} - state={{ c: 456, d: "ABC" }} - > + state={{ c: 456, d: "ABC" }}> 测试:api跳转 | - + GitHub diff --git a/src/component/menu/index.less b/src/component/menu/index.less index eeb8c828..72bebd54 100644 --- a/src/component/menu/index.less +++ b/src/component/menu/index.less @@ -5,10 +5,12 @@ .active { color: #67daf9; } - a { + a, + .link { padding: 0 5px; color: #0066cc; text-decoration: none; + cursor: pointer; &:hover { text-decoration: underline; } diff --git a/src/container/features/index.js b/src/container/features/index.js index 54b8ebe8..e90a70ec 100644 --- a/src/container/features/index.js +++ b/src/container/features/index.js @@ -39,9 +39,7 @@ export default function FeaturesPageContainer(props) {

HMR局部热更新

-
- 使用webpack-dev-middleware 和 webpack-hot-middleware设置了热更新 -
+
使用webpack-dev-middleware 和 webpack-hot-middleware设置了热更新

代码分割

@@ -49,7 +47,7 @@ export default function FeaturesPageContainer(props) {
src/container/root/index.js中能查看例子
-

webpack4.x

+

webpack5.x

使用了最新版本的webpack,编译速度更快
diff --git a/webpack.dev.config.js b/webpack.dev.config.js index 2898f71e..bfc43e56 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -7,6 +7,7 @@ const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin"); const CopyPlugin = require("copy-webpack-plugin"); // 用于直接复制public中的文件到打包的最终文件夹中 const HappyPack = require("happypack"); // 多线程编译 const webpackbar = require("webpackbar"); +const ESLintPlugin = require("eslint-webpack-plugin"); // eslint插件,代替原来的eslint-loader const PUBLIC_PATH = "/"; // 基础路径 module.exports = { @@ -29,13 +30,6 @@ module.exports = { }, module: { rules: [ - { - // 编译前通过eslint检查代码 (注释掉即可取消eslint检测) - test: /\.js?$/, - enforce: "pre", - use: ["eslint-loader"], - include: path.resolve(__dirname, "src"), - }, { // .js .jsx用babel解析 test: /\.js?$/, @@ -88,6 +82,9 @@ module.exports = { }, plugins: [ new webpackbar(), + new ESLintPlugin({ + context: path.resolve(__dirname, "src"), + }), new webpack.HotModuleReplacementPlugin(), // 热更新插件 new AntdDayjsWebpackPlugin(), // dayjs 替代 momentjs new webpack.DefinePlugin({ diff --git a/webpack.production.config.js b/webpack.production.config.js index a1fc7527..01e09c53 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -12,6 +12,7 @@ const CopyPlugin = require("copy-webpack-plugin"); // 用于直接复制public const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); // 自动生成各尺寸的favicon图标 webpack5 wating up const TerserPlugin = require("terser-webpack-plugin"); // 对js进行压缩 const webpackbar = require("webpackbar"); // 进度条 +const ESLintPlugin = require("eslint-webpack-plugin"); // eslint插件,代替原来的eslint-loader // const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; // 分析打包后各个包的大小 /** * 基础路径 @@ -113,6 +114,9 @@ module.exports = { * **/ new CleanWebpackPlugin(), new webpackbar(), // 打包时美化进度条 + new ESLintPlugin({ + context: path.resolve(__dirname, "src"), + }), new AntdDayjsWebpackPlugin(), // dayjs 替代 momentjs /** * 在window环境中注入全局变量,虽然暂时没用上,不过在真实开发中应该会用到 From fb4018397fb43f3b092a10dde74901301e05dcf7 Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Mon, 4 Apr 2022 13:09:10 +0800 Subject: [PATCH 91/98] update --- .eslintrc.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index c964754c..e48cda8f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -28,6 +28,7 @@ "no-catch-shadow": "error", "react/no-unescaped-entities": "off", "react-hooks/rules-of-hooks": "error", - "prettier/prettier": "warn" + "prettier/prettier": "warn", + "no-unused-expressions": "warn" } } From 5f1167c6f0d5573b98d4b3de5d9e2a96a7d89077 Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Fri, 29 Apr 2022 11:19:40 +0800 Subject: [PATCH 92/98] update: packages --- package.json | 54 ++++++++++++++++----------------- src/component/menu/index.js | 9 ++++-- src/container/features/index.js | 4 ++- 3 files changed, 37 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 75884dd8..74da5144 100644 --- a/package.json +++ b/package.json @@ -24,66 +24,66 @@ }, "dependencies": { "@rematch/core": "^2.2.0", - "antd": "^4.18.5", - "axios": "^0.25.0", - "core-js": "^3.21.0", + "antd": "^4.20.1", + "axios": "^0.27.2", + "core-js": "^3.22.3", "lodash": "^4.17.21", - "react": "^17.0.2", - "react-dom": "^17.0.2", + "react": "^18.1.0", + "react-dom": "^18.1.0", "react-loadable": "^5.5.0", - "react-redux": "^7.2.6", - "react-router-dom": "^6.2.1", - "redux": "^4.1.2" + "react-redux": "^8.0.1", + "react-router-dom": "^6.3.0", + "redux": "^4.2.0" }, "devDependencies": { - "@babel/core": "^7.17.0", + "@babel/core": "^7.17.9", "@babel/eslint-parser": "^7.17.0", "@babel/plugin-proposal-class-properties": "^7.16.7", - "@babel/plugin-proposal-decorators": "^7.17.0", + "@babel/plugin-proposal-decorators": "^7.17.9", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", - "@babel/plugin-proposal-object-rest-spread": "^7.16.7", + "@babel/plugin-proposal-object-rest-spread": "^7.17.3", "@babel/plugin-proposal-optional-chaining": "^7.16.7", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-runtime": "^7.17.0", "@babel/preset-env": "^7.16.11", "@babel/preset-react": "^7.16.7", - "@babel/runtime": "^7.17.0", + "@babel/runtime": "^7.17.9", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.4.2", - "babel-loader": "^8.2.3", - "babel-plugin-import": "^1.13.3", + "autoprefixer": "^10.4.5", + "babel-loader": "^8.2.5", + "babel-plugin-import": "^1.13.5", "clean-webpack-plugin": "^4.0.0", "copy-webpack-plugin": "^10.2.4", - "css-loader": "^6.6.0", + "css-loader": "^6.7.1", "css-minimizer-webpack-plugin": "^3.4.1", - "dayjs": "^1.10.7", - "eslint": "^8.8.0", + "dayjs": "^1.11.1", + "eslint": "^8.14.0", "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-react": "^7.28.0", - "eslint-plugin-react-hooks": "^4.3.0", - "eslint-webpack-plugin": "^3.0.1", - "express": "^4.17.2", + "eslint-plugin-react": "^7.29.4", + "eslint-plugin-react-hooks": "^4.5.0", + "eslint-webpack-plugin": "^3.1.1", + "express": "^4.18.0", "favicons": "^6.2.2", "favicons-webpack-plugin": "^5.0.2", "happypack": "^5.0.1", "html-webpack-plugin": "^5.5.0", "less": "^4.1.2", "less-loader": "^10.2.0", - "mini-css-extract-plugin": "^2.5.3", + "mini-css-extract-plugin": "^2.6.0", "mockjs": "^1.1.0", - "postcss": "^8.4.6", + "postcss": "^8.4.12", "postcss-loader": "^6.2.1", - "prettier": "^2.5.1", + "prettier": "^2.6.2", "style-loader": "^3.3.1", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.3.1", - "webpack": "^5.68.0", + "webpack": "^5.72.0", "webpack-bundle-analyzer": "^4.5.0", "webpack-cli": "^4.9.2", "webpack-dev-middleware": "^5.3.1", "webpack-hot-middleware": "^2.25.1", "webpackbar": "^5.0.2", - "workbox-webpack-plugin": "^6.4.2", + "workbox-webpack-plugin": "^6.5.3", "xml-loader": "^1.2.1" }, "browserslist": [ diff --git a/src/component/menu/index.js b/src/component/menu/index.js index 3ce03b7d..a3a67460 100644 --- a/src/component/menu/index.js +++ b/src/component/menu/index.js @@ -26,11 +26,16 @@ export default function Menu() { pathname: "/test", search: "?a=123&b=abc", }} - state={{ c: 456, d: "ABC" }}> + state={{ c: 456, d: "ABC" }} + > 测试:api跳转
| - + GitHub diff --git a/src/container/features/index.js b/src/container/features/index.js index e90a70ec..0cfb5e31 100644 --- a/src/container/features/index.js +++ b/src/container/features/index.js @@ -39,7 +39,9 @@ export default function FeaturesPageContainer(props) {

HMR局部热更新

-
使用webpack-dev-middleware 和 webpack-hot-middleware设置了热更新
+
+ 使用webpack-dev-middleware 和 webpack-hot-middleware设置了热更新 +

代码分割

From 46eb5efe9f8488d9a90f85c604c98bd7f9b1ebf6 Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Thu, 16 Jun 2022 09:28:02 +0800 Subject: [PATCH 93/98] perf: update packages --- .gitignore | 1 + package.json | 68 ++++++++++++++++++------------------- src/component/menu/index.js | 2 +- src/container/test/index.js | 16 +++++---- src/index.js | 4 +-- 5 files changed, 48 insertions(+), 43 deletions(-) diff --git a/.gitignore b/.gitignore index 060f3df3..37cd911d 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ build yarn.lock .vscode/* dll +pnpm-lock.yaml # Optional npm cache directory .npm diff --git a/package.json b/package.json index 74da5144..0758d2ff 100644 --- a/package.json +++ b/package.json @@ -24,63 +24,63 @@ }, "dependencies": { "@rematch/core": "^2.2.0", - "antd": "^4.20.1", + "antd": "^4.21.2", "axios": "^0.27.2", - "core-js": "^3.22.3", + "core-js": "^3.23.1", "lodash": "^4.17.21", - "react": "^18.1.0", - "react-dom": "^18.1.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", "react-loadable": "^5.5.0", - "react-redux": "^8.0.1", + "react-redux": "^8.0.2", "react-router-dom": "^6.3.0", "redux": "^4.2.0" }, "devDependencies": { - "@babel/core": "^7.17.9", - "@babel/eslint-parser": "^7.17.0", - "@babel/plugin-proposal-class-properties": "^7.16.7", - "@babel/plugin-proposal-decorators": "^7.17.9", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", - "@babel/plugin-proposal-object-rest-spread": "^7.17.3", - "@babel/plugin-proposal-optional-chaining": "^7.16.7", + "@babel/core": "^7.18.5", + "@babel/eslint-parser": "^7.18.2", + "@babel/plugin-proposal-class-properties": "^7.17.12", + "@babel/plugin-proposal-decorators": "^7.18.2", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.17.12", + "@babel/plugin-proposal-object-rest-spread": "^7.18.0", + "@babel/plugin-proposal-optional-chaining": "^7.17.12", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.17.0", - "@babel/preset-env": "^7.16.11", - "@babel/preset-react": "^7.16.7", - "@babel/runtime": "^7.17.9", + "@babel/plugin-transform-runtime": "^7.18.5", + "@babel/preset-env": "^7.18.2", + "@babel/preset-react": "^7.17.12", + "@babel/runtime": "^7.18.3", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.4.5", + "autoprefixer": "^10.4.7", "babel-loader": "^8.2.5", "babel-plugin-import": "^1.13.5", "clean-webpack-plugin": "^4.0.0", - "copy-webpack-plugin": "^10.2.4", + "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.7.1", - "css-minimizer-webpack-plugin": "^3.4.1", - "dayjs": "^1.11.1", - "eslint": "^8.14.0", + "css-minimizer-webpack-plugin": "^4.0.0", + "dayjs": "^1.11.3", + "eslint": "^8.17.0", "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-react": "^7.29.4", - "eslint-plugin-react-hooks": "^4.5.0", + "eslint-plugin-react": "^7.30.0", + "eslint-plugin-react-hooks": "^4.6.0", "eslint-webpack-plugin": "^3.1.1", - "express": "^4.18.0", + "express": "^4.18.1", "favicons": "^6.2.2", "favicons-webpack-plugin": "^5.0.2", "happypack": "^5.0.1", "html-webpack-plugin": "^5.5.0", - "less": "^4.1.2", - "less-loader": "^10.2.0", - "mini-css-extract-plugin": "^2.6.0", + "less": "^4.1.3", + "less-loader": "^11.0.0", + "mini-css-extract-plugin": "^2.6.1", "mockjs": "^1.1.0", - "postcss": "^8.4.12", - "postcss-loader": "^6.2.1", - "prettier": "^2.6.2", + "postcss": "^8.4.14", + "postcss-loader": "^7.0.0", + "prettier": "^2.7.0", "style-loader": "^3.3.1", "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^5.3.1", - "webpack": "^5.72.0", + "terser-webpack-plugin": "^5.3.3", + "webpack": "^5.73.0", "webpack-bundle-analyzer": "^4.5.0", - "webpack-cli": "^4.9.2", - "webpack-dev-middleware": "^5.3.1", + "webpack-cli": "^4.10.0", + "webpack-dev-middleware": "^5.3.3", "webpack-hot-middleware": "^2.25.1", "webpackbar": "^5.0.2", "workbox-webpack-plugin": "^6.5.3", diff --git a/src/component/menu/index.js b/src/component/menu/index.js index a3a67460..b79fc166 100644 --- a/src/component/menu/index.js +++ b/src/component/menu/index.js @@ -20,7 +20,7 @@ export default function Menu() { | goToTest()} to={{ pathname: "/test", diff --git a/src/container/test/index.js b/src/container/test/index.js index eb8cba3c..da516f53 100644 --- a/src/container/test/index.js +++ b/src/container/test/index.js @@ -49,8 +49,9 @@ export default function TestPageContainer() { }; // 仅组件加载完毕时触发一次 - useEffect(async () => { + useEffect(() => { // console.log("所有页面默认拥有的3个对象:", location, match, history); + const set = new Set([1, 2, 3]); const map = new Map(); console.log("Set 和 Map 测试:", set, map); @@ -60,11 +61,14 @@ export default function TestPageContainer() { console.log("obj的扩展运算符测试:", b); // 获取用户信息测试 - const userInfo = await dispatch({ - type: "app/getUserinfo", - payload: { id: 1 }, - }); - console.log("获取到userInfo:", userInfo); + async function getUserinfo() { + const userInfo = await dispatch({ + type: "app/getUserinfo", + payload: { id: 1 }, + }); + console.log("获取到userInfo:", userInfo); + } + getUserinfo(); }, []); // 表单提交且验证通过时触发 diff --git a/src/index.js b/src/index.js index e9c8994a..0fa66077 100644 --- a/src/index.js +++ b/src/index.js @@ -3,14 +3,14 @@ // import "regenerator-runtime/runtime"; import React from "react"; -import ReactDOM from "react-dom"; +import ReactDOM from "react-dom/client"; import Root from "./root"; /** 公共样式 **/ import "./styles/css.css"; import "./styles/less.less"; -ReactDOM.render(, document.getElementById("app-root")); +ReactDOM.createRoot(document.getElementById("app-root")).render(); if (module.hot) { module.hot.accept(); From 0bb47a3b1d1a29d182bc71a84c79e4b04045a197 Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Thu, 4 Aug 2022 08:27:18 +0800 Subject: [PATCH 94/98] perf: update packages --- package.json | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 0758d2ff..deb448a1 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^2.2.0", - "antd": "^4.21.2", + "antd": "^4.22.3", "axios": "^0.27.2", - "core-js": "^3.23.1", + "core-js": "^3.24.1", "lodash": "^4.17.21", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -36,32 +36,32 @@ "redux": "^4.2.0" }, "devDependencies": { - "@babel/core": "^7.18.5", - "@babel/eslint-parser": "^7.18.2", - "@babel/plugin-proposal-class-properties": "^7.17.12", - "@babel/plugin-proposal-decorators": "^7.18.2", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.17.12", - "@babel/plugin-proposal-object-rest-spread": "^7.18.0", - "@babel/plugin-proposal-optional-chaining": "^7.17.12", + "@babel/core": "^7.18.10", + "@babel/eslint-parser": "^7.18.9", + "@babel/plugin-proposal-class-properties": "^7.18.6", + "@babel/plugin-proposal-decorators": "^7.18.10", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", + "@babel/plugin-proposal-object-rest-spread": "^7.18.9", + "@babel/plugin-proposal-optional-chaining": "^7.18.9", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.18.5", - "@babel/preset-env": "^7.18.2", - "@babel/preset-react": "^7.17.12", - "@babel/runtime": "^7.18.3", + "@babel/plugin-transform-runtime": "^7.18.10", + "@babel/preset-env": "^7.18.10", + "@babel/preset-react": "^7.18.6", + "@babel/runtime": "^7.18.9", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.4.7", + "autoprefixer": "^10.4.8", "babel-loader": "^8.2.5", "babel-plugin-import": "^1.13.5", "clean-webpack-plugin": "^4.0.0", "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.7.1", "css-minimizer-webpack-plugin": "^4.0.0", - "dayjs": "^1.11.3", - "eslint": "^8.17.0", - "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-react": "^7.30.0", + "dayjs": "^1.11.4", + "eslint": "^8.21.0", + "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-react": "^7.30.1", "eslint-plugin-react-hooks": "^4.6.0", - "eslint-webpack-plugin": "^3.1.1", + "eslint-webpack-plugin": "^3.2.0", "express": "^4.18.1", "favicons": "^6.2.2", "favicons-webpack-plugin": "^5.0.2", @@ -72,18 +72,18 @@ "mini-css-extract-plugin": "^2.6.1", "mockjs": "^1.1.0", "postcss": "^8.4.14", - "postcss-loader": "^7.0.0", - "prettier": "^2.7.0", + "postcss-loader": "^7.0.1", + "prettier": "^2.7.1", "style-loader": "^3.3.1", "sw-precache-webpack-plugin": "^1.0.0", "terser-webpack-plugin": "^5.3.3", - "webpack": "^5.73.0", + "webpack": "^5.74.0", "webpack-bundle-analyzer": "^4.5.0", "webpack-cli": "^4.10.0", "webpack-dev-middleware": "^5.3.3", "webpack-hot-middleware": "^2.25.1", "webpackbar": "^5.0.2", - "workbox-webpack-plugin": "^6.5.3", + "workbox-webpack-plugin": "^6.5.4", "xml-loader": "^1.2.1" }, "browserslist": [ From 3762d073a40c827358b7e7b61d350e138c12f619 Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Sat, 13 Aug 2022 10:07:09 +0800 Subject: [PATCH 95/98] perf: pagckages --- package.json | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index deb448a1..4da1ab58 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@rematch/core": "^2.2.0", - "antd": "^4.22.3", + "antd": "^4.22.4", "axios": "^0.27.2", "core-js": "^3.24.1", "lodash": "^4.17.21", @@ -56,7 +56,7 @@ "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.7.1", "css-minimizer-webpack-plugin": "^4.0.0", - "dayjs": "^1.11.4", + "dayjs": "^1.11.5", "eslint": "^8.21.0", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-react": "^7.30.1", @@ -71,17 +71,16 @@ "less-loader": "^11.0.0", "mini-css-extract-plugin": "^2.6.1", "mockjs": "^1.1.0", - "postcss": "^8.4.14", + "postcss": "^8.4.16", "postcss-loader": "^7.0.1", "prettier": "^2.7.1", "style-loader": "^3.3.1", - "sw-precache-webpack-plugin": "^1.0.0", - "terser-webpack-plugin": "^5.3.3", + "terser-webpack-plugin": "^5.3.4", "webpack": "^5.74.0", "webpack-bundle-analyzer": "^4.5.0", "webpack-cli": "^4.10.0", "webpack-dev-middleware": "^5.3.3", - "webpack-hot-middleware": "^2.25.1", + "webpack-hot-middleware": "^2.25.2", "webpackbar": "^5.0.2", "workbox-webpack-plugin": "^6.5.4", "xml-loader": "^1.2.1" From 5f4921a83e85a29f9a1e404bfb410d3953acdc80 Mon Sep 17 00:00:00 2001 From: JavaLuo <376693576@qq.com> Date: Thu, 25 Aug 2022 18:02:38 +0800 Subject: [PATCH 96/98] update --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 4da1ab58..741b8acd 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@rematch/core": "^2.2.0", - "antd": "^4.22.4", + "antd": "^4.22.7", "axios": "^0.27.2", - "core-js": "^3.24.1", + "core-js": "^3.25.0", "lodash": "^4.17.21", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -36,7 +36,7 @@ "redux": "^4.2.0" }, "devDependencies": { - "@babel/core": "^7.18.10", + "@babel/core": "^7.18.13", "@babel/eslint-parser": "^7.18.9", "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-decorators": "^7.18.10", @@ -57,9 +57,9 @@ "css-loader": "^6.7.1", "css-minimizer-webpack-plugin": "^4.0.0", "dayjs": "^1.11.5", - "eslint": "^8.21.0", + "eslint": "^8.22.0", "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-react": "^7.30.1", + "eslint-plugin-react": "^7.31.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-webpack-plugin": "^3.2.0", "express": "^4.18.1", @@ -75,9 +75,9 @@ "postcss-loader": "^7.0.1", "prettier": "^2.7.1", "style-loader": "^3.3.1", - "terser-webpack-plugin": "^5.3.4", + "terser-webpack-plugin": "^5.3.5", "webpack": "^5.74.0", - "webpack-bundle-analyzer": "^4.5.0", + "webpack-bundle-analyzer": "^4.6.1", "webpack-cli": "^4.10.0", "webpack-dev-middleware": "^5.3.3", "webpack-hot-middleware": "^2.25.2", From 9e735454b22c7be8b7d28e44c93067f7fdb1cf7d Mon Sep 17 00:00:00 2001 From: JavaLuo <376693576@qq.com> Date: Wed, 28 Sep 2022 11:38:07 +0800 Subject: [PATCH 97/98] perf: update pacakges / remove history --- package.json | 33 +++++++++++++++++---------------- src/container/routers/index.js | 6 +++--- src/container/test/index.js | 6 ++++-- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 741b8acd..ade02d50 100644 --- a/package.json +++ b/package.json @@ -23,47 +23,48 @@ "pnp": false }, "dependencies": { + "@ant-design/icons": "^4.7.0", "@rematch/core": "^2.2.0", - "antd": "^4.22.7", + "antd": "^4.23.2", "axios": "^0.27.2", - "core-js": "^3.25.0", + "core-js": "^3.25.3", "lodash": "^4.17.21", "react": "^18.2.0", "react-dom": "^18.2.0", "react-loadable": "^5.5.0", - "react-redux": "^8.0.2", - "react-router-dom": "^6.3.0", + "react-redux": "^8.0.4", + "react-router-dom": "^6.4.1", "redux": "^4.2.0" }, "devDependencies": { - "@babel/core": "^7.18.13", - "@babel/eslint-parser": "^7.18.9", + "@babel/core": "^7.19.3", + "@babel/eslint-parser": "^7.19.1", "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-proposal-decorators": "^7.18.10", + "@babel/plugin-proposal-decorators": "^7.19.3", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", "@babel/plugin-proposal-object-rest-spread": "^7.18.9", "@babel/plugin-proposal-optional-chaining": "^7.18.9", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.18.10", - "@babel/preset-env": "^7.18.10", + "@babel/plugin-transform-runtime": "^7.19.1", + "@babel/preset-env": "^7.19.3", "@babel/preset-react": "^7.18.6", - "@babel/runtime": "^7.18.9", + "@babel/runtime": "^7.19.0", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.4.8", + "autoprefixer": "^10.4.12", "babel-loader": "^8.2.5", "babel-plugin-import": "^1.13.5", "clean-webpack-plugin": "^4.0.0", "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.7.1", - "css-minimizer-webpack-plugin": "^4.0.0", + "css-minimizer-webpack-plugin": "^4.1.0", "dayjs": "^1.11.5", - "eslint": "^8.22.0", + "eslint": "^8.24.0", "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-react": "^7.31.0", + "eslint-plugin-react": "^7.31.8", "eslint-plugin-react-hooks": "^4.6.0", "eslint-webpack-plugin": "^3.2.0", "express": "^4.18.1", - "favicons": "^6.2.2", + "favicons": "6.2.2", "favicons-webpack-plugin": "^5.0.2", "happypack": "^5.0.1", "html-webpack-plugin": "^5.5.0", @@ -75,7 +76,7 @@ "postcss-loader": "^7.0.1", "prettier": "^2.7.1", "style-loader": "^3.3.1", - "terser-webpack-plugin": "^5.3.5", + "terser-webpack-plugin": "^5.3.6", "webpack": "^5.74.0", "webpack-bundle-analyzer": "^4.6.1", "webpack-cli": "^4.10.0", diff --git a/src/container/routers/index.js b/src/container/routers/index.js index d849ad4a..e15485a2 100644 --- a/src/container/routers/index.js +++ b/src/container/routers/index.js @@ -16,7 +16,7 @@ import { ConfigProvider } from "antd"; import zhCN from "antd/lib/locale-provider/zh_CN"; // import { createBrowserHistory as createHistory } from "history/"; // URL模式的history -import { createHashHistory as createHistory } from "history"; // 锚点模式的history +// import { createHashHistory as createHistory } from "history"; // 锚点模式的history import Loadable from "react-loadable"; // 用于代码分割时动态加载模块 @@ -61,7 +61,7 @@ const NotFound = Loadable({ loading: Loading, }); -const history = createHistory(); // 实例化history对象 +// const history = createHistory(); // 实例化history对象 /** 组件 **/ export default function RootRouterContainer(props) { @@ -88,7 +88,7 @@ export default function RootRouterContainer(props) { return ( <> - +
} /> diff --git a/src/container/test/index.js b/src/container/test/index.js index da516f53..30ecb037 100644 --- a/src/container/test/index.js +++ b/src/container/test/index.js @@ -14,7 +14,8 @@ import ImgTest from "../../assets/test.jpg"; import Mp3 from "../../assets/starSky.mp3"; /** 组件 **/ -export default function TestPageContainer() { +export default function TestPageContainer(props) { + const dispatch = useDispatch(); const count = useSelector((state) => state.test.count); // 引入test model中的count数据 @@ -145,6 +146,7 @@ export default function TestPageContainer() { > } placeholder="密码" /> @@ -209,7 +211,7 @@ export default function TestPageContainer() {
setVisible(false)} onCancel={() => setVisible(false)} > From a551c868257830db93ae04908984407611475033 Mon Sep 17 00:00:00 2001 From: javaLuo <376693576@qq.com> Date: Mon, 14 Nov 2022 13:19:19 +0800 Subject: [PATCH 98/98] update packages --- package.json | 50 ++++++++++++++++++------------------- src/container/test/index.js | 1 - webpack.dev.config.js | 10 ++++---- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index ade02d50..eccb91af 100644 --- a/package.json +++ b/package.json @@ -25,63 +25,63 @@ "dependencies": { "@ant-design/icons": "^4.7.0", "@rematch/core": "^2.2.0", - "antd": "^4.23.2", - "axios": "^0.27.2", - "core-js": "^3.25.3", + "antd": "^4.24.2", + "axios": "^1.1.3", + "core-js": "^3.26.1", + "favicons": "6.2.2", "lodash": "^4.17.21", "react": "^18.2.0", "react-dom": "^18.2.0", "react-loadable": "^5.5.0", - "react-redux": "^8.0.4", - "react-router-dom": "^6.4.1", + "react-redux": "^8.0.5", + "react-router-dom": "^6.4.3", "redux": "^4.2.0" }, "devDependencies": { - "@babel/core": "^7.19.3", + "@babel/core": "^7.20.2", "@babel/eslint-parser": "^7.19.1", "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-proposal-decorators": "^7.19.3", + "@babel/plugin-proposal-decorators": "^7.20.2", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.18.9", + "@babel/plugin-proposal-object-rest-spread": "^7.20.2", "@babel/plugin-proposal-optional-chaining": "^7.18.9", "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.19.1", - "@babel/preset-env": "^7.19.3", + "@babel/plugin-transform-runtime": "^7.19.6", + "@babel/preset-env": "^7.20.2", "@babel/preset-react": "^7.18.6", - "@babel/runtime": "^7.19.0", + "@babel/runtime": "^7.20.1", "antd-dayjs-webpack-plugin": "^1.0.6", - "autoprefixer": "^10.4.12", - "babel-loader": "^8.2.5", + "autoprefixer": "^10.4.13", + "babel-loader": "^9.1.0", "babel-plugin-import": "^1.13.5", "clean-webpack-plugin": "^4.0.0", "copy-webpack-plugin": "^11.0.0", - "css-loader": "^6.7.1", - "css-minimizer-webpack-plugin": "^4.1.0", - "dayjs": "^1.11.5", - "eslint": "^8.24.0", + "css-loader": "^6.7.2", + "css-minimizer-webpack-plugin": "^4.2.2", + "dayjs": "^1.11.6", + "eslint": "^8.27.0", "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-react": "^7.31.8", + "eslint-plugin-react": "^7.31.10", "eslint-plugin-react-hooks": "^4.6.0", "eslint-webpack-plugin": "^3.2.0", - "express": "^4.18.1", - "favicons": "6.2.2", + "express": "^4.18.2", "favicons-webpack-plugin": "^5.0.2", "happypack": "^5.0.1", "html-webpack-plugin": "^5.5.0", "less": "^4.1.3", - "less-loader": "^11.0.0", + "less-loader": "^11.1.0", "mini-css-extract-plugin": "^2.6.1", "mockjs": "^1.1.0", - "postcss": "^8.4.16", + "postcss": "^8.4.19", "postcss-loader": "^7.0.1", "prettier": "^2.7.1", "style-loader": "^3.3.1", "terser-webpack-plugin": "^5.3.6", - "webpack": "^5.74.0", - "webpack-bundle-analyzer": "^4.6.1", + "webpack": "^5.75.0", + "webpack-bundle-analyzer": "^4.7.0", "webpack-cli": "^4.10.0", "webpack-dev-middleware": "^5.3.3", - "webpack-hot-middleware": "^2.25.2", + "webpack-hot-middleware": "^2.25.3", "webpackbar": "^5.0.2", "workbox-webpack-plugin": "^6.5.4", "xml-loader": "^1.2.1" diff --git a/src/container/test/index.js b/src/container/test/index.js index 30ecb037..c5f9ed3c 100644 --- a/src/container/test/index.js +++ b/src/container/test/index.js @@ -15,7 +15,6 @@ import Mp3 from "../../assets/starSky.mp3"; /** 组件 **/ export default function TestPageContainer(props) { - const dispatch = useDispatch(); const count = useSelector((state) => state.test.count); // 引入test model中的count数据 diff --git a/webpack.dev.config.js b/webpack.dev.config.js index bfc43e56..69b051d0 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -5,7 +5,7 @@ const webpack = require("webpack"); // webpack核心 const HtmlWebpackPlugin = require("html-webpack-plugin"); // 动态生成html插件 const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin"); const CopyPlugin = require("copy-webpack-plugin"); // 用于直接复制public中的文件到打包的最终文件夹中 -const HappyPack = require("happypack"); // 多线程编译 +// const HappyPack = require("happypack"); // 多线程编译 const webpackbar = require("webpackbar"); const ESLintPlugin = require("eslint-webpack-plugin"); // eslint插件,代替原来的eslint-loader const PUBLIC_PATH = "/"; // 基础路径 @@ -33,7 +33,7 @@ module.exports = { { // .js .jsx用babel解析 test: /\.js?$/, - use: ["happypack/loader"], + use: ["babel-loader"], include: path.resolve(__dirname, "src"), }, { @@ -90,9 +90,9 @@ module.exports = { new webpack.DefinePlugin({ "process.env": "dev", }), - new HappyPack({ - loaders: ["babel-loader"], - }), + // new HappyPack({ + // loaders: ["babel-loader"], + // }), new HtmlWebpackPlugin({ // 根据模板插入css/js等生成最终HTML filename: "index.html", //生成的html存放路径,相对于 output.path