Environment variable breaking build
See original GitHub issueDescribe 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
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:10 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
vite@2.8.3 was realesed to patch this regression
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.