microbundle icon indicating copy to clipboard operation
microbundle copied to clipboard

Failed to resolve the module node:*

Open ahmadnassri opened this issue 1 year ago • 1 comments

node core modules can imported with node: prefix, e.g. require('node:fs') don't seem to work.

image

ahmadnassri avatar Aug 11 '22 04:08 ahmadnassri

Just a warning, and already resolved by #956. Just hasn't been released yet.

rschristian avatar Aug 11 '22 04:08 rschristian

Just release 0.15.1 so this should be corrected.

Thanks

rschristian avatar Aug 12 '22 22:08 rschristian

Thank you @rschristian

ahmadnassri avatar Aug 12 '22 23:08 ahmadnassri

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. The target for Microbundle is not necessarily 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 continue to appear with:

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

Is this intended, and (if not) should I file a separate issue for it?

donmccurdy avatar Mar 21 '23 14:03 donmccurdy

@donmccurdy Separate issue please, if you can

rschristian avatar Mar 21 '23 14:03 rschristian