rollup: PARSE_ERROR when code contains "process.env ="
See original GitHub issueDescribe the bug
The error caused by phaser
library . And then I found: if the code contains process.env=<any>
and run vite build
, it will raise a rollup parserError.
Reproduction
Write process.env={}
any where and run vite build
.
System Info
- required
vite
version: 1.0.0-rc.4 - required Operating System: MacOS 10.15.7
- required Node version: 14.7.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (7 by maintainers)
Top Results From Across the Web
rollup-plugin-inject-process-env - npm
Inject environment variables in process.env with Rollup. ... TypeScript icon, indicating that this package has built-in type declarations.
Read more >Build Setup Recipes
You can use an environment variable like process.env. ... Of course, make sure to have the relevant dependencies like `rollup-plugin-babel @babel/core` and ...
Read more >Environment variables in svelte + rollup - Stack Overflow
You can inject build time constants in compiled code with @rollup/plugin-replace. Something like this: rollup.config.js
Read more >VMware SD-WAN 4.3.1 Release Notes
Orchestrator rollup build R431-20220429-GA includes fixed issues #84152 ... includes this fix has enhanced path information processing code ...
Read more >How to Set Up Environment Variables using JSON files with ...
Installing Rollup Plugins. Since the Single-page application considers Rollup.js as the module bundler, we'll need to install a couple of node ...
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
This is quite easy, you can come up with a
hack.ts
: https://gist.github.com/hyrious/6817207816032d532a10e53e4c3daac8Then in
package.json
:BTW, I’ve tried mermaid in vite2, it seems there’s no such issue at all.
It would be great if we could figure out a workaround together. It might seem like
process.env = {}
is a byproduct from webpack (or whichever bundler the library creators use) making builds runnable in the browser.In my project
In the source of one of the dependencies that contain it
I suspect we would need to ask a lot of maintainers to change their builds if we want to get rid of this error without using a workaround.