Cannot use with prettier-plugin-tailwindcss
martitv opened this issue · comments
Martin Theodor Vasbotten commented
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\prettier-plugin-tailwindcss@0.5.4_prettier@3.0.3\node_modules\prettier-plugin-tailwindcss\dist\index.mjs not supported.
Instead change the require of \node_modules\.pnpm\prettier-plugin-tailwindcss@0.5.4_prettier@3.0.3\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\prettier-plugin-tailwindcss@0.5.4_prettier@3.0.3\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?
Fabien BERNARD commented
Hey 👋
Can you share your prettier config? I never encounter this issue before…
Martin Theodor Vasbotten commented
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'],
}
Nicolae Racovita commented
the issue is actually that prettier used here is v2, pls update to v3