2024-02-06 06:16:28 -05:00
|
|
|
npx nx g @nx/web:application example-plugin --directory=apps/example-plugin
|
|
|
|
|
|
|
|
Create a manifes.json in /public
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"name": "Example plugin",
|
|
|
|
"code": "http://localhost:4201/plugin.js"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2024-02-27 08:50:38 -05:00
|
|
|
Add to the example `vite.config.ts`
|
2024-02-06 06:16:28 -05:00
|
|
|
|
|
|
|
```json
|
|
|
|
build: {
|
|
|
|
rollupOptions: {
|
|
|
|
input: {
|
|
|
|
plugin: 'src/plugin.ts',
|
|
|
|
index: './index.html',
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
entryFileNames: '[name].js',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2024-02-27 08:50:38 -05:00
|
|
|
Add to `tsconfig.app.json`
|
|
|
|
|
|
|
|
```json
|
|
|
|
"include": ["src/**/*.ts", "../../libs/plugins-runtime/src/lib/index.d.ts"]
|
|
|
|
```
|
|
|
|
|
2024-02-06 06:16:28 -05:00
|
|
|
Run static server `npx nx run example-plugin:serve-static --port 4201`
|
|
|
|
|
|
|
|
Go to penpot and load the plugin.
|
|
|
|
|
|
|
|
```ts
|
|
|
|
ɵloadPlugin({ manifest: 'http://localhost:4201/manifest.json' });
|
|
|
|
```
|