ecmascript-6 - 如何在 create-react-app 中定义 process.env.ENV?

标签 ecmascript-6 environment-variables create-react-app

同版本1.0.5create-react-app样板我已经开始收到休耕警告:*** process.env.ENV is not defined, assuming 'prod' env
我知道如何创建自定义环境变量,但那些需要 REACT_APP_字首。

现在,我发现显示消息是因为 Chrome 的 Grammarly扩展,并禁用它会删除消息。

但是,无论扩展名如何,我都想知道如何解决此问题。

我知道 StackOverflow 上还有 2 个这样的问题,但它们包括使用 Webpack 的解决方案。不幸的是,我无法访问 Webpack,因为我还没有弹出 create-react-app,而且我不打算很快这样做。

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

编辑:

这是主要问题。技术上是否可以在 中定义它?未弹出 create-react-app ?

最佳答案

语法扩展不是 React 的原因。已向 Grammarly Support 记录了一个请求,这是结果

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.

关于ecmascript-6 - 如何在 create-react-app 中定义 process.env.ENV?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44919392/

相关文章:

javascript - 如何从数组中选取数据并从中创建单个对象?

c# - 如何在 C# 中永久设置环境变量

reactjs - ' react -i18next : withNamespaces is not a function' when testing

yaml - 如何通过 CLI 覆盖 helm 环境变量?

reactjs - 如何使用 create-react-app 运行构建版本?

javascript - 调试: ESLint Warning "Function declared in a loop contains unsafe references to variable(s)...no-loop-func"

javascript - 无法读取未定义的属性 'dropdown'

javascript - ES6 异步 promise

javascript - 在 contenteditable 插入符位置占 `<br>` s

batch-file - 使环境变量在 ENDLOCAL 中存活