create-react-app-在生产版本中检查Redux商店 [英] create-react-app - inspect Redux store in production build
问题描述
我正在使用 create-react-app
作为我正在使用的应用程序的初始支架,该支架存在于现有的php / jQuery应用程序中。经过一番摆弄之后,我已经能够通过使用此处。
I am using create-react-app
as an initial scaffold for an app that I am working on that exists within an existing php/jQuery app. After a bit of fiddling about I have been able to setup communication between the non-React app and the React app by using the method described here.
我正在做什么正在创建React应用程序的 build
并将其插入到非React应用程序中,但是我发现对应用程序的构建版本进行故障排除很麻烦,因为我无法通过Chrome的Redux插件检查Redux商店。我猜想作为 create-react-app
的一部分,无法从生产就绪版本检查Redux存储的功能吗?我试图避免尽可能退出应用程序,所以想知道是否有任何方法可以检查Redux商店的生产版本吗?
What I'm currently doing is creating a build
of the React app then inserting it into the non-React app, however I am finding troubleshooting the build version of the app slow and cumbersome because I am unable to inspect the Redux store through Chrome's Redux plugin. I am guessing that the ability to inspect the Redux store from a production ready build is disabled as part of create-react-app
? I'm trying to avoid ejecting the app if possible so am wondering if there is any way to inspect the Redux store for the production build?
推荐答案
仅仅意识到这完全是我自己的错-在为Redux商店设置配置时,我已经指定:
Just realised that it was completely my own fault - when setting up the configuration for Redux store I had specified:
if (process.env.NODE_ENV === 'development') {
const devToolsExtension = window.devToolsExtension;
if (typeof devToolsExtension === 'function') {
enhancers.push(devToolsExtension());
}
}
我删除了<$ c $的条件c> process.end.NODE_ENV ==='开发',现在我可以从生产版本中检查Redux商店了。
I've removed the conditional on process.end.NODE_ENV === 'development'
and I can now inspect Redux store from production build.
感谢评论建议。抱歉浪费您的时间!
Thanks to commenters on suggestions. Sorry to waste your time!
这篇关于create-react-app-在生产版本中检查Redux商店的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!