Skip to content

consider using node: import prefixes #31

@joprice

Description

@joprice

When attempting to run some code making use of the fs builtin via deno, I get the error

error: Relative import path "fs" not prefixed with / or ./ or ../
If you want to use a built-in Node module, add a "node:" prefix (ex. "node:fs").

Versions of since 16 and >= 14.18 have support for prefixed builtins https://nodejs.org/api/modules.html#built-in-modules, so there is a compatibility concern.

You can work around this with deno (and possibly something similar for bun) by using import maps or --unstable-bare-node-builtins, but it is also mentioned in the Node docs using the prefixes has the benefit of avoiding another module of the same name unintentionally shadowing the builtin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions