question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Environment variable breaking build

See original GitHub issue

Describe the bug

I have an environment variable that is a license key for a product in my project, it has some characters in there that seem to be breaking the build.

Can be reproduced in a vite.new.

Reproduction

https://stackblitz.com/edit/vitejs-vite-zqmwee?file=.env&terminal=dev

System Info

System:
    OS: macOS 12.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 152.78 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
    npm: 6.14.13 - ~/.nvm/versions/node/v14.17.0/bin/npm
  Browsers:
    Brave Browser: 92.1.28.106
    Chrome: 98.0.4758.80
    Firefox: 91.0.1
    Safari: 15.2
  npmPackages:
    @vitejs/plugin-legacy: ^1.6.4 => 1.7.0 
    @vitejs/plugin-vue: ^1.2.2 => 1.10.2 
    vite: ^2.8.0 => 2.8.0

Used Package Manager

npm

Logs

❯ vite --debug
  vite:config no config file found. +0ms
error when starting dev server:
TypeError: Cannot read properties of undefined (reading 'split')
    at eval (/home/projects/vitejs-vite-zqmwee/node_modules/vite/dist/node/chunks/dep-c9c9d3e5.js:70732:33)
    at Array.reduce (<anonymous>)
    at _interpolate (/home/projects/vitejs-vite-zqmwee/node_modules/vite/dist/node/chunks/dep-c9c9d3e5.js:70718:18)
    at expand (/home/projects/vitejs-vite-zqmwee/node_modules/vite/dist/node/chunks/dep-c9c9d3e5.js:70762:32)
    at loadEnv (/home/projects/vitejs-vite-zqmwee/node_modules/vite/dist/node/chunks/dep-c9c9d3e5.js:71386:13)
    at resolveConfig (/home/projects/vitejs-vite-zqmwee/node_modules/vite/dist/node/chunks/dep-c9c9d3e5.js:70869:9)
    at async createServer (/home/projects/vitejs-vite-zqmwee/node_modules/vite/dist/node/chunks/dep-c9c9d3e5.js:56354:20)
    at async CAC.eval (/home/projects/vitejs-vite-zqmwee/node_modules/vite/dist/node/cli.js:688:24)

Validations

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
patak-devcommented, Feb 15, 2022

vite@2.8.3 was realesed to patch this regression

1reaction
sodateacommented, Feb 15, 2022

We need a more verbose error message here. The error stack doesn’t clearly tell us which file caused the error. It should at least show the file name; and the line number if possible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build environment variables | Netlify Docs
Identify environment variables available in the build environment, set your own environment variables, and use environment variables during builds.
Read more >
How To Manage Environment Variables? - Humanitec
To sum up, multiple factors can create struggles when it comes to environment variables: fear of breaking, loss of control, and the need...
Read more >
Breaking change: Environment variable prefixes - .NET
NET 7 breaking change in .NET extensions where the comparison of normalized prefixes and environment variables has changed.
Read more >
Understanding Docker Build Args, Environment Variables and ...
An overview of ways to set and use variables when building images, starting containers and using docker-compose.
Read more >
Build Environment Variables - genomewiki
and then set two environment variables: set USE_SAMTABIX to 1 and set SAMTABIXDIR to your local samtabix build directory. (If you have manually ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found