From 58e2223e3a5dd63c590c591d810daececc4395e4 Mon Sep 17 00:00:00 2001 From: whevether Date: Mon, 4 Dec 2023 22:32:45 +0800 Subject: [PATCH] update --- package.json | 30 +++++++++++++++--------------- readme.md | 6 ++++-- src/store/configureStore.dev.js | 4 ++-- src/store/configureStore.prod.js | 4 ++-- webpack.config.js | 3 ++- webpack.config.prod.js | 3 ++- 6 files changed, 27 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 011d8cc..c64ad89 100644 --- a/package.json +++ b/package.json @@ -35,30 +35,30 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-helmet": "^6.1.0", - "react-redux": "^8.1.3", - "react-router-dom": "^6.19.0", - "redux": "^4.2.1", + "react-redux": "^9.0.0", + "react-router-dom": "^6.20.1", + "redux": "^5.0.0", "redux-first-history": "^5.1.1", - "redux-thunk": "^2.4.2" + "redux-thunk": "^3.1.0" }, "devDependencies": { - "@babel/cli": "^7.23.0", - "@babel/core": "^7.23.3", + "@babel/cli": "^7.23.4", + "@babel/core": "^7.23.5", "@babel/eslint-parser": "^7.23.3", "@babel/plugin-syntax-async-generators": "^7.8.4", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/plugin-transform-arrow-functions": "^7.23.3", - "@babel/plugin-transform-async-generator-functions": "^7.23.3", + "@babel/plugin-transform-async-generator-functions": "^7.23.4", "@babel/plugin-transform-async-to-generator": "^7.23.3", "@babel/plugin-transform-class-properties": "^7.23.3", - "@babel/plugin-transform-json-strings": "^7.23.3", - "@babel/plugin-transform-optional-chaining": "^7.23.3", + "@babel/plugin-transform-json-strings": "^7.23.4", + "@babel/plugin-transform-optional-chaining": "^7.23.4", "@babel/plugin-transform-react-constant-elements": "^7.23.3", - "@babel/plugin-transform-runtime": "^7.23.3", - "@babel/preset-env": "^7.23.3", + "@babel/plugin-transform-runtime": "^7.23.4", + "@babel/preset-env": "^7.23.5", "@babel/preset-react": "^7.23.3", - "@babel/runtime": "^7.23.2", + "@babel/runtime": "^7.23.5", "@loadable/component": "^5.15.3", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11", "@vitejs/plugin-react": "^4.2.0", @@ -74,7 +74,7 @@ "css-loader": "^6.8.1", "css-minimizer-webpack-plugin": "5.0.1", "enzyme": "^3.11.0", - "eslint": "^8.54.0", + "eslint": "^8.55.0", "eslint-plugin-import": "^2.29.0", "eslint-plugin-react": "^7.33.2", "eslint-watch": "^8.0.0", @@ -93,8 +93,8 @@ "sass": "^1.69.5", "sass-loader": "^13.3.2", "style-loader": "^3.3.3", - "unplugin-auto-import": "^0.16.7", - "vite": "^5.0.0", + "unplugin-auto-import": "^0.17.2", + "vite": "^5.0.5", "vite-plugin-compression2": "^0.11.0", "vite-plugin-cdn2": "^0.15.2", "vite-plugin-svg-icons": "^2.0.1", diff --git a/readme.md b/readme.md index f94f188..6410219 100644 --- a/readme.md +++ b/readme.md @@ -41,9 +41,11 @@ ##### (2023.07.22) 1. 添加vite 配置 2. 完善vite 配置 +##### (2023.12.04) +1. 升级redux 依赖 ##### 示例图片 -[![示例图片](./screen/1.gif) "示例图片")](https://react.keep-wan.me "示例") +[![示例图片](./screen/1.gif) "示例图片")](https://react.zytravel.shop "示例") #演示 -[演示](https://react.keep-wan.me "演示") +[演示](https://react.zytravel.shop "演示") ##### npm 8 安装命令 `npm i --legacy-peer-deps` diff --git a/src/store/configureStore.dev.js b/src/store/configureStore.dev.js index 5656e2f..fcaee05 100644 --- a/src/store/configureStore.dev.js +++ b/src/store/configureStore.dev.js @@ -1,6 +1,6 @@ import {createStore, compose, applyMiddleware} from 'redux'; -import thunkMiddleware from 'redux-thunk'; +import {withExtraArgument} from 'redux-thunk'; import rootReducer from './reducers'; import {request} from 'utils/request'; import { createReduxHistoryContext } from "redux-first-history"; @@ -29,7 +29,7 @@ export default function configureStore(history,initialState) { }); const middlewares = [ routerMiddleware, - thunkMiddleware.withExtraArgument(request(history)), + withExtraArgument(request(history)), ]; const store = createStore(rootReducer(routerReducer), initialState, compose( applyMiddleware(...middlewares) diff --git a/src/store/configureStore.prod.js b/src/store/configureStore.prod.js index ecab701..f7ff67d 100644 --- a/src/store/configureStore.prod.js +++ b/src/store/configureStore.prod.js @@ -1,5 +1,5 @@ import {createStore, compose, applyMiddleware} from 'redux'; -import thunkMiddleware from 'redux-thunk'; +import {withExtraArgument} from 'redux-thunk'; import rootReducer from './reducers'; import {request} from 'utils/request'; import { createReduxHistoryContext } from "redux-first-history"; @@ -28,7 +28,7 @@ export default function configureStore(history,initialState) { }); const middlewares = [ routerMiddleware, - thunkMiddleware.withExtraArgument(request(history)), + withExtraArgument(request(history)), ]; const store = createStore(rootReducer(routerReducer), initialState, compose( applyMiddleware(...middlewares) diff --git a/webpack.config.js b/webpack.config.js index 93156bf..373f080 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,6 +3,7 @@ const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); //生成html并注入 const CopyWebpackPlugin = require('copy-webpack-plugin'); //拷贝资源文件 const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin'); +const AutoImport = require('unplugin-auto-import/webpack'); const config = { resolve: { extensions: ['*', '.js', '.jsx', '.json'], @@ -63,7 +64,7 @@ const config = { allowCollectingMemory: true, }, plugins: [ - require('unplugin-auto-import/webpack')({ + AutoImport.default({ imports: ["react","react-router-dom"], }), new ReactRefreshWebpackPlugin({overlay: false}), diff --git a/webpack.config.prod.js b/webpack.config.prod.js index c2c281b..6e375bf 100644 --- a/webpack.config.prod.js +++ b/webpack.config.prod.js @@ -4,6 +4,7 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin"); //打包压缩c const HtmlWebpackPlugin = require('html-webpack-plugin'); //生成html并注入 const CopyWebpackPlugin = require('copy-webpack-plugin'); //拷贝资源文件 const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); +const AutoImport = require('unplugin-auto-import/webpack'); const path = require('path'); // 设置node.js生产环境变量 const GLOBALS = { @@ -109,7 +110,7 @@ const config = { allowCollectingMemory: true, }, plugins: [ - require('unplugin-auto-import/webpack')({ + AutoImport.default({ imports: ["react","react-router-dom"], }), // 编译环境变量