Skip to content
This repository was archived by the owner on Sep 2, 2023. It is now read-only.
This repository was archived by the owner on Sep 2, 2023. It is now read-only.

Feature: NodeJS contextual pathing use cases #121

@guybedford

Description

@guybedford

There are a number of workflows in NodeJS today that use __filename and __dirname to handle contextual paths relative to the current module itself.

Currently we are looking at exposing a import.meta.url which will be a file URL of the current module.

To use this contextual URL in NodeJS APIs requires a rather unwieldy conversion process along the lines of:

const filename = decodeURI(
  new URL(import.meta.url).pathname.substr(process.platform === 'win32' ? 1 : 0))
);

It would be great if we could allow a much more polished workflow here for users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions