如何在create-react-app中定义process.env.ENV? [英] How to define process.env.ENV in create-react-app?

查看:2661
本文介绍了如何在create-react-app中定义process.env.ENV?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 create-react-app 样板的版本 1.0.5 我已经开始接收休闲警告:
*** process.env.ENV未定义,假设'prod'env



我知道如何创建一个自定义的环境变量,但是需要 REACT_APP _ 前缀。



发现由于Chrome的语法扩展名,消息正在显示,并禁用它会删除该消息。



然而,我想知道如何解决这个问题,无论扩展。



我知道StackOverflow还有2个这样的问题,但是它们包括使用Webpack的解决方案。不幸的是,我没有访问Webpack,因为我没有弹出创建反应应用程序,我不打算很快。



有没有办法在 create-react-app process.env.ENV 中声明环境? strong>



编辑:



这是主要的问题。在未弹出的 创建反应应用程序

解决方案

语法扩展是这个不是React的原因。已经使用语法支持记录了请求,这是结果


Hailey(语法支持)
Jul 6,11:33 PM PDT



Hi Lankymart,



感谢您联系Grammarly客户支持!



请放心,技术团队知道问题,目前正在处理中。



不幸的是,这不会很快修复,我不能为您提供估计的时间表,因为开发人员需要一些时间来分析这个问题的原因。



我要关闭这个案例,但如果您有关于此问题的进一步信息,请回复此电子邮件,案例将重新开放以进一步调查。对于造成的任何不便,我们深表歉意。



祝你美好,祝您,
Hailey






Lankymart
七月6,12:49 PM PDT



Chrome中的控制台窗口不断显示警告 - process.env ENV没有定义关闭扩展删除错误,它与特定网站无关。已经在互联网上的线索正在弹出与报告相同问题的人,而公共线程是语法。证据:



https://github.com/facebookincubator/create-react-app/issues/2722#issuecomment- 313017403
如何在create-react-app中定义process.env.ENV?
https://stackoverflow.com/a/44940512/692942



网址:
没有特定的网址问题是扩展错误。



With the version 1.0.5 of the create-react-app boilerplate I've started receiving the fallowing warning: *** process.env.ENV is not defined, assuming 'prod' env

I know how to create a custom environmental variables, but those require REACT_APP_ prefix.

Now, I've discovered that the message is being shown because of the Chrome's Grammarly extension, and disabling it removes the message.

However, I'd like to know how I can resolve this regardless of the extensions.

I know that there are 2 more questions like this on the StackOverflow, but they include solutions that are using the Webpack. Unfortunately, I have no access to the Webpack, since I haven't ejected the create-react-app, and I don't plan to anytime soon.

Is there a way to declare the environment on process.env.ENV in create-react-app?

EDIT:

This was the main question. Is it technically possible to define it in the non-ejected create-react-app?

解决方案

The Grammarly extension is the cause of this not React. Have logged a request with Grammarly Support and this is the result

Hailey (Grammarly Support) Jul 6, 11:33 PM PDT

Hi Lankymart,

Thank you for contacting Grammarly Customer Support!

Please rest assured that the technical team is aware of the problem and they are currently working on it.

Unfortunately, this will not be a quick fix and I cannot provide you with an estimated timeframe, as the developers will need some time to analyze the cause of this issue.

I’m going to close this case, but if you have further information regarding this issue, please reply to this email and the case will be re-opened for further investigation. We apologize for any inconvenience caused.

Best wishes, Hailey


Lankymart Jul 6, 12:49 PM PDT

The console window in Chrome is constantly showing the warning - "process.env.ENV is not defined" turning off the extensions removes the error, it is not related a specific website. Already on the internet threads are popping up with people reporting the same issue and the common thread is Grammarly. Has a bug been introduced into the extension perhaps?

Evidence:

https://github.com/facebookincubator/create-react-app/issues/2722#issuecomment-313017403 How to define process.env.ENV in create-react-app? https://stackoverflow.com/a/44940512/692942

Website URL: No specific URL issue is a extension bug.

这篇关于如何在create-react-app中定义process.env.ENV?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆