Skip to content

consider using node: import prefixes #31

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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