import meta ponyfill isn't compatible with frontend only npm packages
- Dominant language
- Rust
- Stars
- 1.3k
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
When I use some `import.meta` stuff e.g. import.meta.url for frontend only npm package, dnt adds ponyfill wich is for node.js.
It has imports like `import { createRequire } from "node:module", import { fileURLToPath, pathToFileURL } from "node:url", import { dirname } from "node:path";`
Webpack (and other bundlers I think) has serious trouble with such npm package. Mostly it cannot be compiled, bundled and ends with errors like
```
ERROR in node:module
#14 33.40 Module build failed: UnhandledSchemeError: Reading from "node:module" is not handled by plugins (Unhandled scheme).
#14 33.40 Webpack supports "data:" and "file:" URIs by default.
#14 33.40 You may need an additional plugin to handle "node:" URIs.
```
It's highly desired to use polyfills, ponyfills conditionally (#471) .
Contributor guide
Assessment
This issue has not been assessed yet.