Skip to content

motss/unocss-issue-astro-import-meta-env

Repository files navigation

Missing import.meta.env using unocss@66 on astro 5

Pre-requisites

// This is the version of node and pnpm I use on my machine.
"engines": {
  "node": "23.8.0",
  "pnpm": "10.4.1"
}

Steps to reproduce

  1. Run pnpm install to install all dependencies.
  2. Run pnpm dev to run astro in dev mode.
  3. You will see the following logs in the terminal.
    undefined # this logs the value from import.meta.env
    Cannot read properties of undefined (reading 'NODE_ENV') # this is the error due to missing import.meta.env
  4. Done.

Reinstall with unocss@65.4.3

  1. Update and pin the version of unocss to 65.4.3.
    - "unocss": "66.0.0"
    - "unocss": "65.4.3"
  2. Force install all dependencies by running pnpm install --force.
  3. Run pnpm dev and no errors.
  4. Done.

References

  1. unocss/unocss#4441

About

Unable to read import.meta.env in unocss in astro

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published