Skip to content

Failed to resolve the module node:* when target ≠ "node" #1036

Open
@donmccurdy

Description

@donmccurdy

Similar to #989, but now occurring only when Microbundle's target is not Node.js. I'm compiling a library that runs in both Node.js and a browser, and the library contains dynamic imports for node built-ins like 'fs', executed only in Node.js.

When importing fs I can add the following to my package.json and everything works fine:

"browser": {
  "fs": false,
  "path": false
},

However, using node:fs, the same thing does not work, and warnings appear with:

"browser": {
  "node:fs": false,
  "node:path": false
},
Failed to resolve the module node:fs

Microbundle v0.15.1, Node.js v18.12.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions