You are currently using minified code outside of NODE_ENV === ‘production’. This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) to ensure you have the correct code for your production build.
解决方法:非production环境不启用代码压缩即可。
例如vite配置:
1 2 3 4 |
build: { // 压缩 minify: process.env.VITE_NODE_ENV === 'production' ? 'esbuild' : false, }, |
此时需要在 env.development 和 env.production中配置 VITE_NODE_ENV
如:env.development中
1 |
VITE_NODE_ENV = 'development' |