dprint / dprint

Pluggable and configurable code formatting platform written in Rust.

Home Page:https://dprint.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when loading custom plugin, missing export get_plugin_schema_version

stevenliebregt opened this issue · comments

No matter what I try, whenever I build a plugin, be it one I made myself or an official one like the sql plugin and then try to load it in my dprint.json as a file I'm getting the following error:

Error resolving plugin ...: Error determining plugin schema version. Are you sure this is a dprint plugin? Missing export get_plugin_schema_version

Plugins are built using cargo build --release --target=wasm32-unknown-unknown per docs.

What am I missing?

You'll need to compile with the wasm feature as well (all the crates follow this pattern, but it's not prescribed):

cargo build --target wasm32-unknown-unknown --features wasm

https://github.com/dprint/dprint-plugin-sql/blob/e86e127011e3a4ca9becbbc0e352546138f3b95c/.github/workflows/ci.yml#L37

That will add the wasm exports. The reason the separate feature is necessary is to allow people to use the formatter in wasm scenarios without automatically adding exports.