remix icon indicating copy to clipboard operation
remix copied to clipboard

Error loops when clientLoader crashes after setting environment variables in root.tsx

Open mkizka opened this issue 9 months ago • 1 comments

Reproduction

  1. Access https://stackblitz.com/edit/remix-run-remix-t17vmh?file=README.md
  2. Open Preview in new tab
  3. Open Chrome DevTools

The only files edited are app/route/_index.tsx and app/root.tsx. I followed https://remix.run/docs/en/main/guides/envvars to set the environment variables.

image

System Info

$ npx envinfo --system --npmPackages '{vite,@remix-run/*}' --binaries --browsers
Need to install the following packages:
[email protected]
Ok to proceed? (y) y

  System:
    OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12400
    Memory: 13.46 GB / 15.62 GB
    Container: Yes
    Shell: 3.7.0 - /usr/bin/fish
  Binaries:
    Node: 20.13.0 - ~/.local/share/mise/installs/node/lts/bin/node
    npm: 10.5.2 - ~/.local/share/mise/installs/node/lts/bin/npm
    pnpm: 8.15.7 - ~/.local/share/mise/installs/node/lts/bin/pnpm
  Browsers:
    Chrome: 121.0.6167.85
  npmPackages:
    @remix-run/dev: ^2.9.2 => 2.9.2 
    @remix-run/node: ^2.9.2 => 2.9.2 
    @remix-run/react: ^2.9.2 => 2.9.2 
    @remix-run/serve: ^2.9.2 => 2.9.2 
    vite: ^5.1.0 => 5.2.11

Used Package Manager

pnpm

Expected Behavior

Error does not loop, and is displayed on the screen.

Actual Behavior

Error loops and nothing is displayed on the screen.

mkizka avatar May 12 '24 11:05 mkizka

I found a workaround. Regarding the environment variables, you can revert to root.tsx and use the VITE_ prefix and import.meta.env. https://vitejs.dev/guide/env-and-mode.html

mkizka avatar May 12 '24 15:05 mkizka