Skip to content

mlly throws [error] The URL must be of scheme file when called with absolute path on windows #297

Description

@danielroe

Environment

windows
mlly 1.7.3

Reproduction

danielroe/windows-reproductions#1

Describe the bug

When called with an absolute path on Windows, resolvePathSync fails.

Sample code:

import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'

import { resolvePathSync } from 'mlly'

resolvePathSync(
  resolve(fileURLToPath(import.meta.url), '../plugins/router'))
  { extensions: ['.ts', '.js'] }
)

full reproduction

Additional context

originally encountered in nuxt/nuxt#30540

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions