Skip to content

import.meta.env.* cause env variable is void 0 #386

@windsonR

Description

@windsonR

Describe the bug

When update to 7.1.2(also 7.1.3and 7.1.4),
use this code will cause build env variable is undefined.
for example:

https://github.com/windsonR/rolldown-vite-demo/blame/26234c064ddb3c6ac5bb48d3191d29c9c278e20f/src/main.js#L9

it will be compiled to

(void 0)()

Reproduction

checkout env-issue and switch to env-issue branch.

Steps to reproduce

  1. Input a env usage,and make it toUpperCase,like import.meta.env.VITE_DEMO_ENV.toUpperCase()
  2. build.

System Info

System:
    OS: macOS 15.6.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 643.95 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.4.1 - ~/.n/bin/node
    Yarn: 1.22.22 - ~/.n/bin/yarn
    npm: 11.5.1 - ~/.n/bin/npm
    pnpm: 9.15.9 - ~/.n/bin/pnpm
  Browsers:
    Chrome: 139.0.7258.128
    Edge: 139.0.3405.102
    Safari: 18.6
  npmPackages:
    @vitejs/plugin-vue: ^5.2.3 => 5.2.3 
    rolldown-vite:  7.1.4

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: upstreamBug in a dependency of Vitefeat: native pluginsrelated to exprimental.enableNativePlugins

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions