Build your plugin
Before deploying, ensure your plugin is compiled to a single JavaScript file:TypeScript compilation
If you’re using TypeScript, compile it to JavaScript:Using a bundler
For dependencies or advanced builds, use a bundler like Vite, tsdown, or esbuild:Hosting options
Plugins must be accessible via HTTPS and support cross-origin requests (CORS).GitHub (recommended)
Host your plugin in a GitHub repository and use raw URLs:- Free hosting
- Version control built-in
- CORS enabled by default
- Easy to update
GitHub Gist
For single-file plugins, use a Gist:- Create a new Gist at gist.github.com
- Add your plugin code
- Click “Create public gist”
- Click the “Raw” button to get the URL
CDN services
Host on a CDN that supports ESM:CDN URLs typically cache aggressively. Use version tags or commit SHAs to ensure updates are reflected.
Plugin structure requirements
Your plugin file must:- Be a valid ES module
- Export as default or named
plugin
- Support cross-origin requests
- GitHub raw URLs work automatically
- Custom servers must set
Access-Control-Allow-Origin: *
Security considerations
Plugins run in a Web Worker with limited globals. Only these are available:- Standard JavaScript built-ins (
Array,Object,Math,Date, etc.) consolefor debugging- Plugin SDK exports (
definePlugin,h,findChild, etc.)
- DOM APIs (
document,window,localStorage) - Network requests (
fetch,XMLHttpRequest) - Node.js APIs (
fs,path,process) - Third-party libraries (unless bundled)
Testing your plugin
Local testing
- Run a local dev server (e.g., Vite, Next.js):
- Use the local network URL in TemPad Dev:
- Changes will reflect after manually updating in Preferences
Browser testing
- Open TemPad Dev in Figma
- Go to Preferences → Plugins
- Paste your plugin URL
- Click Save
- Select an element to see your plugin’s output
Plugin code is cached in browser local storage. You must click “Update” or re-paste the URL to reload changes.
Sharing your plugin
Option 1: Share the URL
Simply share your plugin URL with others:Option 2: Add to official registry
Contribute to the plugin registry so users can install by name:- Fork the TemPad Dev repository
- Edit
packages/extension/plugins/available-plugins.json - Add your plugin:
- Submit a pull request
Example repository structure
Here’s a recommended structure for a plugin repository:Example package.json
Versioning and updates
Versioning strategy
- Use semantic versioning in your repository
- Tag releases in GitHub:
- Update the URL when breaking changes occur:
Changelog
Maintain aCHANGELOG.md to document changes:
Real-world examples
Study these production plugins for reference:- Kong Design System - Justineo/tempad-dev-plugin-kong
- Tailwind CSS - haydenull/tempad-dev-plugin-tailwind
- React Native - CANntyield/tempad-dev-plugin-react-native
Troubleshooting
Plugin not loading
- ✅ Check that the URL is accessible in your browser
- ✅ Verify CORS headers allow cross-origin requests
- ✅ Ensure the file is a valid ES module
- ✅ Check browser console for error messages
Changes not reflecting
- ✅ Manually update the plugin from Preferences
- ✅ Clear browser cache and reload
- ✅ Use version tags in URLs to bypass caching
Transform not working
- ✅ Check that your hook returns a string (or
DevComponentfortransformComponent) - ✅ Verify the hook name matches exactly (
transform,transformVariable, etc.) - ✅ Test with simple console.log statements to debug
Next steps
Available Plugins
Browse the official plugin registry
Plugin Overview
Learn more about the plugin system