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] when use with prettier-plugin-tailwindcss. Can you update prettier to v3? #41

Closed
shatynska opened this issue Nov 24, 2023 · 2 comments · Fixed by #44

Comments

@shatynska
Copy link

Hi!
First of all, thanks for your library, it really helps me a lot.
However, I found out that when I used prettier-plugin-tailwindcss, it caused errors.

Error [ERR_REQUIRE_ESM]: require() of ES Module /.../node_modules/prettier-plugin-tailwindcss/dist/index.mjs not supported.
Instead change the require of /.../node_modules/prettier-plugin-tailwindcss/dist/index.mjs to a dynamic import() which is available in all CommonJS modules.

My research has led to a hypothesis that it is because of the version of Prettier in your lib.

As @thecrypticace in tailwindlabs wrote

That script is using Prettier 2 to format files and we only support Prettier 3, and Prettier 2 autoloads plugins, and Prettier 2 does not support ESM. Only require() / CJS.

I think there are related issues from other libs:

Is it possible to update the prettier version from 2 to 3?
Thanks in advance!

@WakuwakuP
Copy link

I'm also experiencing this issue.

@zoubingwu
Copy link
Owner

@shatynska @WakuwakuP Hey this should be fixed in 0.18.0 pls upgrade and try it again.

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

Successfully merging a pull request may close this issue.

3 participants