-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
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
Labels
No labels