Giter Site home page Giter Site logo

Comments (5)

XantreDev avatar XantreDev commented on June 5, 2024

Here is a patch that fixes an issue:

@[email protected]

diff --git a/build/env.js b/build/env.js
index f5e5e4efd8609d683d709219acf8b46554e62978..4c1bc0fc8baeae92fff946dcfd31cc60252f968f 100644
--- a/build/env.js
+++ b/build/env.js
@@ -138,24 +138,22 @@ function createControlledEnvironment() {
   function _expandEnv(parsedEnv) {
     const expandedEnv = {};
 
+    const processEnv = {...process.env}
+    for (const key in parsedEnv) {
+      delete processEnv[key]
+    }
     // Pass a clone of `process.env` to avoid mutating the original environment.
     // When the expansion is done, we only store the environment variables that were initially parsed from `parsedEnv`.
-    const allExpandedEnv = (0, _dotenvExpand().expand)({
+    (0, _dotenvExpand().expand)({
       parsed: parsedEnv,
-      processEnv: {
-        ...process.env
-      }
+      processEnv: processEnv
     });
-    if (allExpandedEnv.error) {
-      console.error(`Failed to expand environment variables, using non-expanded environment variables: ${allExpandedEnv.error}`);
-      return parsedEnv;
-    }
 
     // Only store the values that were initially parsed, from `parsedEnv`.
     for (const key of Object.keys(parsedEnv)) {
       var _allExpandedEnv$parse;
-      if ((_allExpandedEnv$parse = allExpandedEnv.parsed) !== null && _allExpandedEnv$parse !== void 0 && _allExpandedEnv$parse[key]) {
-        expandedEnv[key] = allExpandedEnv.parsed[key];
+      if ((_allExpandedEnv$parse = parsedEnv) !== null && _allExpandedEnv$parse !== void 0 && _allExpandedEnv$parse[key]) {
+        expandedEnv[key] = parsedEnv[key];
       }
     }
     return expandedEnv;

We need to allow keys to be overwritten, because existing keys is prefered https://github.com/motdotla/dotenv-expand/blob/ff7e2efd0d9925c7da82c167ae77d22a6c76e878/lib/main.js#L24C10-L31

from expo.

XantreDev avatar XantreDev commented on June 5, 2024

If you want I can provide a pr with this changes. But this do not fixes that change of env vars do not cause automatic server reload

from expo.

expo-bot avatar expo-bot commented on June 5, 2024

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

from expo.

byCedric avatar byCedric commented on June 5, 2024

Hi @XantreDev! Thanks for the issue report.

If you want I can provide a pr with this changes.

Yeah, feel free to open a PR that applies the fix you mentioned. Let's consider the auto-reload, or HMR, issue separate from this one.

from expo.

XantreDev avatar XantreDev commented on June 5, 2024

Ok. @byCedric I will provide it today/tomorrow

from expo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.