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

[ERR_REQUIRE_ESM] Error using webpack or babel #611

Closed
rafaelgdn opened this issue Oct 5, 2023 · 1 comment
Closed

[ERR_REQUIRE_ESM] Error using webpack or babel #611

rafaelgdn opened this issue Oct 5, 2023 · 1 comment

Comments

@rafaelgdn
Copy link

Anyone know how to fix this error?

require() of ES Module /Users/rafaeldecarvalho/dev/bgc/criminal/bgc-scrapers/node_modules/file-type/index.js from /Users/rafaeldecarvalho/dev/bgc/criminal/bgc-scrapers/.webpack/HealthsurveillanceCrawl/src/functions/crawl/healthsurveillance.js not supported.\n' + 'Instead change the require of index.js in /Users/rafaeldecarvalho/dev/bgc/criminal/bgc-scrapers/.webpack/HealthsurveillanceCrawl/src/functions/crawl/healthsurveillance.js to a dynamic import() which is available in all CommonJS modules.

I tried to import in a dynamic way like that:
const fileTypeDynamicImport = async () => { const fileType = await import("file-type"); return fileType; };

I tried to add some configs to babel to ignore dynamic import:
[ "@babel/preset-env", { "exclude": [ "proposal-dynamic-import" ] } ]

I dont know how to solve this. Any help?

@sindresorhus
Copy link
Owner

@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants