0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 13:43:03 -05:00
This commit is contained in:
Alex Sánchez 2024-04-15 10:57:50 +02:00
parent 3ec79dab48
commit 2744930ada
No known key found for this signature in database
GPG key ID: 68A95170EEB87E16
2 changed files with 3 additions and 3 deletions

View file

@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"build": "npm run build:ui && npm run build:main -- --minify",
"build:main": "esbuild plugin-src/code.ts --bundle --outfile=dist/code.js",
"build:main": "esbuild plugin-src/code.ts --bundle --outfile=dist/code.js --target=es2016",
"build:ui": "vite build --minify esbuild --emptyOutDir=false",
"build:watch": "concurrently -n widget,iframe \"npm run build:main -- --watch\" \"npm run build:ui -- --watch\"",
"dev": "concurrently -n tsc,build,vite 'npm:tsc:watch' 'npm:build:watch' 'vite'",

View file

@ -16,14 +16,14 @@ export const PenpotExporter = () => {
};
const onMessage = (event: MessageEvent<{ pluginMessage: { type: string; data: unknown } }>) => {
if (event.data.pluginMessage.type == 'FIGMAFILE') {
if (event.data.pluginMessage?.type == 'FIGMAFILE') {
const document = event.data.pluginMessage.data as PenpotDocument;
const file = createPenpotFile(document);
file.export();
setExporting(false);
} else if (event.data.pluginMessage.type == 'FONT_NAME') {
} else if (event.data.pluginMessage?.type == 'FONT_NAME') {
const fontName = event.data.pluginMessage.data as string;
if (!validateFont(fontName)) {