Skip to content

[bug] Cannot resolve std-env in nitro v3 #122

@schplitt

Description

@schplitt

Description

The nitro (v3) plugin imports from nitro/runtime-config.

Usage of evlog fails in a nitro (v3) project as evlog is treated as external by Nitro's bundler. This means nitro/runtime-config is not transformed by Nitro but delegated to the runtime (Node/Bun/Deno) to resolve.

At runtime, the import resolves to Nitro's stub implementation which imports std-env - a package that is not installed.

Fix is to add evlog to Nitro's noExternal option. This forces Nitro to bundle evlog and properly transform the nitro/runtime-config import.

Reproduction

  1. Create a new nitro v3 project
  2. Install evlog
  3. Register evlog plugin
  4. Run dev
  5. See error

Logs

Worker error: Cannot find package 'std-env' imported from /node_modules/nitro/dist/runtime/virtual/_runtime_warn.mjs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions