Sec-ant / prettier-plugin-embed

A configurable Prettier plugin to format embedded languages in JS/TS Files.
https://www.npmjs.com/package/prettier-plugin-embed/v/latest
MIT License
54 stars 2 forks source link

Support for CommonJS #98

Open jgeurts opened 4 months ago

jgeurts commented 4 months ago

Hi,

Unfortunately, the project I am trying to add this to is not an ES module. When prettier is loading the plugin, it is failing with a message similar to:

Invalid configuration file `foo.sql`: require() of ES Module /Users/foobar/dev/helloworld/node_modules/prettier-plugin-embed/dist/index.js from /Users/foobar/dev/helloworld/prettier.config.js not supported.

Is there any way to add cjs output for this library?

Sec-ant commented 4 months ago

I'm not sure but I think the plugin resolution is handled by Prettier itself, not the project. So as long as you're using Prettier v3, this plugin should work as expected. Can you provide more information on how you're using Prettier and this plugin?