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

Cannot use with prettier-plugin-tailwindcss #200

Closed
martitv opened this issue Sep 14, 2023 · 3 comments
Closed

Cannot use with prettier-plugin-tailwindcss #200

martitv opened this issue Sep 14, 2023 · 3 comments

Comments

@martitv
Copy link

martitv commented Sep 14, 2023

If i try to use the cli npx @openapi-codegen/cli init i get the error:

Internal Error: require() of ES Module \node_modules\.pnpm\[email protected][email protected]\node_modules\prettier-plugin-tailwindcss\dist\index.mjs not supported.
Instead change the require of \node_modules\.pnpm\[email protected][email protected]\node_modules\prettier-plugin-tailwindcss\dist\index.mjs to a dynamic import() which is available in all CommonJS modules.
Instead change the require of \node_modules\.pnpm\[email protected][email protected]\node_modules\prettier-plugin-tailwindcss\dist\index.mjs to a dynamic import() which is available in all CommonJS modules.
    at \AppData\Local\npm-cache\_npx\4e8b916f75f8b48f\node_modules\prettier\index.js:38143:10
    at Array.map (<anonymous>)
    at Object.load (\AppData\Local\npm-cache\_npx\4e8b916f75f8b48f\node_modules\prettier\index.js:38141:128)
    at Object.load [as loadPlugins] (\AppData\Local\npm-cache\_npx\4e8b916f75f8b48f\node_modules\prettier\index.js:16147:23)
    at \AppData\Local\npm-cache\_npx\4e8b916f75f8b48f\node_modules\prettier\index.js:38181:24
    at Object.format \AppData\Local\npm-cache\_npx\4e8b916f75f8b48f\node_modules\prettier\index.js:38197:12)
    at InitCommand.execute (file:///C:/Users/mava/AppData/Local/npm-cache/_npx/4e8b916f75f8b48f/node_modules/@openapi-codegen/cli/lib/cli.js:77923:40)
    at async InitCommand.validateAndExecute (\AppData\Local\npm-cache\_npx\4e8b916f75f8b48f\node_modules\clipanion\lib\advanced\Command.js:73:26)
    at async Cli.run (\AppData\Local\npm-cache\_npx\4e8b916f75f8b48f\node_modules\clipanion\lib\advanced\Cli.js:223:24)
    at async Cli.runExit (\AppData\Local\npm-cache\_npx\4e8b916f75f8b48f\node_modules\clipanion\lib\advanced\Cli.js:232:28)

This is probably due to the following line in cli.js:

const updatedConfig = prettier.format(printer.printFile(updatedConfigSourceFile), { parser: "babel-ts", ...prettierConfig });

Is there any way to make this work?

@fabien0102
Copy link
Owner

Hey 👋

Can you share your prettier config? I never encounter this issue before…

@martitv
Copy link
Author

martitv commented Sep 18, 2023

This seems to be more of an issue with the prettier-plugin-tailwindcss as than with this library. Posted an issue there instead: tailwindlabs/prettier-plugin-tailwindcss#214. I think this can be closed unless you know of anything you can do to fix this

Wasnt anything special, just had that particular plugin:

module.exports = {
    plugins: ['prettier-plugin-tailwindcss'],
}

@martitv martitv closed this as completed Sep 18, 2023
@nikravi
Copy link
Contributor

nikravi commented Oct 27, 2023

the issue is actually that prettier used here is v2, pls update to v3

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

3 participants