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

Error [ERR_REQUIRE_ESM]: require() of ES Module #90

Closed
joao-offerfit opened this issue Oct 17, 2024 · 5 comments
Closed

Error [ERR_REQUIRE_ESM]: require() of ES Module #90

joao-offerfit opened this issue Oct 17, 2024 · 5 comments

Comments

@joao-offerfit
Copy link

Hello guys,

I'm integrating XO under a Vue project using the XO CLI, and I'm having a hard time while trying to apply XO typescript rules under .vue files.

I already found a solution that require changes in the XO CLI (issue)

Meanwhile, I am trying to extend xo-typescript into .vue files, so I can achieve the same result (even if it's redundant as XO have it already bundled)

I am consistently receiving the error: Error [ERR_REQUIRE_ESM]: require() of ES Module

I made a repo from scratch where it is possible to reproduce the issue. Could someone help me understand why this happens?

Repo: https://github.com/joao-offerfit/vue-xo-demo

@fregante
Copy link
Member

I ran npm run xo on that project and I don't see the issue. Please include more info.

Either way, this is not a problem with this config.

@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2024
@joao-offerfit
Copy link
Author

joao-offerfit commented Oct 18, 2024

Sorry, I should have provided better directions.

Try running npx xo --print-config=src/App.vue > output.txt, it does not work while I have xo-typescript under my extends applied to .vue files.

(I also use pnpm instead of npm in this project but I don't think this changes anything)

This is what I see:

Screenshot 2024-10-18 at 10 23 30

@fregante
Copy link
Member

fregante commented Oct 18, 2024

Check out the readme on this repo. If you use XO, you can't use it together with this config because this is a eslint config, not an xo config.

I think the main issue is that this is a flat config while XO itself hasn't been updated to use it yet.

@joao-offerfit
Copy link
Author

Makes sense! Thanks for clarifying!

@joao-offerfit
Copy link
Author

You gave me an incredible idea... It works if I use v5 (which does not use flat config). Thank you so much for that!

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