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

Does this work with ESM? #3

Open
mansona opened this issue Oct 19, 2021 · 2 comments
Open

Does this work with ESM? #3

mansona opened this issue Oct 19, 2021 · 2 comments

Comments

@mansona
Copy link

mansona commented Oct 19, 2021

I'm trying to use import-cwd with eslint and I think they have moved to ESM on their newest release 🤔

When I try to import-cwd I get the following error:

/Users/mansona/git/projects/lint-to-the-future/lint-to-the-future-eslint/node_modules/esm/esm.js:1
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/mansona/git/qonto/qonto-js/node_modules/@eslint/eslintrc/universal.js
require() of ES modules is not supported.
require() of /Users/mansona/git/qonto/qonto-js/node_modules/@eslint/eslintrc/universal.js from /Users/mansona/git/qonto/qonto-js/node_modules/eslint/lib/linter/linter.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename universal.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/mansona/git/qonto/qonto-js/node_modules/@eslint/eslintrc/package.json.

It could be because I'm using the esm module but I'm not sure why it was working before and suddenly stopped working 🤔

@sindresorhus
Copy link
Owner

See: sindresorhus/import-from#9

@mansona
Copy link
Author

mansona commented Oct 19, 2021

aha! I was wondering why other people hadn't reported anything like this already 😂 thanks for the link! I'll subscribe there now.

I'm happy to close this if you think it's better to keep the discussion in one place, what do you think?

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