Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Nuxt 4.4.x dev server emits raw Windows paths for internal vite-builder virtual imports #35491

Description

@OliverGamborg

Environment

  • Operating System: Microsoft Windows NT 10.0.26200.0
  • Node Version: v22.22.2
  • npm Version: 10.9.7
  • Nuxt Version: 4.4.8
  • Nitro Version: 2.13.4
  • Vite Version: 7.3.6
  • Vue Version: 3.5.35
  • Builder: vite

Reproduction

Enable legacyExternals on a windows machine running nuxt version 4.4.8 and possibly node version 22.22.2

nitro: {
  experimental: {
    legacyExternals: true,
  },
}

Simply run npm run dev and inspect the localhost:3000 page for errors.

Describe the bug

On Windows, enabling Nitro legacy externals causes Nuxt to generate a raw absolute Windows path in .nuxt/dev/index.mjs:

import _... from 'C:/.../node_modules/@nuxt/vite-builder/dist/fix-stacktrace'

Node treats C: as an unsupported URL scheme and fails with:

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

Expected behavior

Nuxt should emit a valid file URL on Windows, for example:

import _... from 'file:///C:/.../node_modules/@nuxt/vite-builder/dist/fix-stacktrace.mjs'

Metadata

Metadata

Assignees

No one assigned

    Labels

    nitroNitro server engine integrationpending triageupstreamIssue caused by a dependency or upstream project

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions