developit / microbundle

📦 Zero-configuration bundler for tiny modules.
https://npm.im/microbundle
MIT License
8k stars 361 forks source link

Failed to resolve the module node:* #989

Closed ahmadnassri closed 1 year ago

ahmadnassri commented 1 year ago

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

image

rschristian commented 1 year ago

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

rschristian commented 1 year ago

Just release 0.15.1 so this should be corrected.

Thanks

ahmadnassri commented 1 year ago

Thank you @rschristian

donmccurdy commented 1 year ago

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?

rschristian commented 1 year ago

@donmccurdy Separate issue please, if you can