Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to load polyfill using native node ESM #110

Open
perrin4869 opened this issue Jun 8, 2021 · 0 comments · May be fixed by #169
Open

Fails to load polyfill using native node ESM #110

perrin4869 opened this issue Jun 8, 2021 · 0 comments · May be fixed by #169
Labels

Comments

@perrin4869
Copy link

Reproducible on latest node 16.3.0:

❯ cat package.json
{
  "type": "module",
  "devDependencies": {
    "cross-fetch": "^3.1.4"
  }
}
❯ cat index.js
import "cross-fetch/polyfill";
❯ node --experimental-specifier-resolution=node index.js
node:internal/process/esm_loader:74
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/perrin4869/univapay/cross-fetch-esm/node_modules/cross-fetch/polyfill' imported from /home/perrin4869/univapay/cross-fetch-esm/index.js
Did you mean to import cross-fetch-esm/node_modules/cross-fetch/dist/node-polyfill.js?
    at new NodeError (node:internal/errors:363:5)
    at finalizeResolution (node:internal/modules/esm/resolve:296:11)
    at moduleResolve (node:internal/modules/esm/resolve:742:10)
    at Loader.defaultResolve [as _resolve] (node:internal/modules/esm/resolve:853:11)
    at Loader.resolve (node:internal/modules/esm/loader:89:40)
    at Loader.getModuleJob (node:internal/modules/esm/loader:242:28)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:73:40)
    at link (node:internal/modules/esm/module_job:72:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Not sure if this should be treated as a node bug or as a cross-fetch bug though...

@geco geco mentioned this issue Aug 10, 2021
@lquixada lquixada added the esm label May 30, 2023
@unional unional linked a pull request Jul 19, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants