Plugins work by exporting an es6 default
component, which is of the RoomPlugin
type
from the types definitions
Typescript is used in the build process to make type completion automatic, which greatly improves the developer experience
First, go ahead and clone the repository. This will give you all the source for types and etc to make development easy. This may be streamlined with an npm plugin in the future.
Edit plugin.ts with plugin logic while utilizing ONLY type
imports from the types or plugins libraries.
If you want to use external imports and get their types, consider using a dynamic import with a devDependency
. It would look something like the following
// example.js
const some_package: typeof import("some_package") =
await import("https://esm.sh/...some_package");
// package.json
{
...,
"devDependencies": {
...,
"some_package": "..."
}
}
To build the plugin, run the npm build script:
npm run build
This will output a Javascript module at build/plugin-template/plugin.js
, which you can upload to any file hosting service and provide its URI for the app to load.
You can build and serve this plugin file, and use the live website to test plugins by running:
npm run build:watch & npm run serve
You could go ahead and just commit this
plugin.js
file if you want to use github raw file links as your persisting plugin URL