Figma-Linux / figma-linux

Figma is the first interface design tool based in the browser, making it easier for teams to create software. Join us in https://t.me/figma_linux
GNU General Public License v2.0
2.66k stars 159 forks source link

React, Webpack based figma plugin code doesn't run after version 0.11.0 onwards #358

Closed satenshakya closed 8 months ago

satenshakya commented 9 months ago

Bug description I have used React and Webpack to develop the Figma plugin UI. It worked fine with version 0.10.0 but after the 0.11.0 update, the plugin did not run.

Getting the following error: Promise (id: "17") reject via error: in figma plugin

ChugunovRoman commented 9 months ago

@satenshakya could you run the app from terminal and pin the output after the plugin crash?

ChugunovRoman commented 9 months ago

@satenshakya Or can you provide a plugin sample which triggers this bug?

spfoos commented 8 months ago

I have the same issue.

You can recreate it by creating a new plugin. Move code.js to a subfolder like dist. Update manifest.json to "main": "dist/code.js". Then try to import the plugin.

Something about the code is a subfolder causes the error.

Here is the sample manifest.json { "name": "test", "id": "1327027891131770454", "api": "1.0.0", "main": "dist/code.js", "capabilities": [], "enableProposedApi": false, "editorType": [ "figma" ], "networkAccess": { "allowedDomains": [ "none" ] } }

andirsun commented 8 months ago

Same Error with our @streamlinehq plugin.

Screencast from 2024-01-11 07-53-34.webm

This is the error log when running figma from flatpak console. @ChugunovRoman

Error occurred in handler for 'createMultipleNewLocalFileExtensions': Error: Filename "dist/figma.js" not allowed
    at _hasFigmaSession.validateFileName (/app/figma-linux/resources/app.asar/main/main.js:1:69749)
    at _hasFigmaSession.validateExtensionFiles (/app/figma-linux/resources/app.asar/main/main.js:1:70165)
    at _hasFigmaSession.addExtension (/app/figma-linux/resources/app.asar/main/main.js:1:68724)
    at o (/app/figma-linux/resources/app.asar/main/main.js:1:71564)
    at async Promise.all (index 0)
    at async _hasFigmaSession.createMultipleNewLocalFileExtensions (/app/figma-linux/resources/app.asar/main/main.js:1:71651)
    at async WebContents.<anonymous> (node:electron/js2c/browser_init:2:88640)
Archangel603 commented 8 months ago

Same here. Manjaro, AUR package, v0.11.2, can't import Vue 2 app built with Webpack. Before the update everything was ok. It also works when manifest is in the same directory as plugin's files (code.js, app.html, etc)

Error occurred in handler for 'createMultipleNewLocalFileExtensions': Error: Filename "dist/code.js" not allowed
    at _hasFigmaSession.validateFileName (/opt/figma-linux/resources/app.asar/main/main.js:1:69749)
    at _hasFigmaSession.validateExtensionFiles (/opt/figma-linux/resources/app.asar/main/main.js:1:70165)
    at _hasFigmaSession.addExtension (/opt/figma-linux/resources/app.asar/main/main.js:1:68724)
    at o (/opt/figma-linux/resources/app.asar/main/main.js:1:71564)
    at async Promise.all (index 0)
    at async _hasFigmaSession.createMultipleNewLocalFileExtensions (/opt/figma-linux/resources/app.asar/main/main.js:1:71651)
    at async WebContents.<anonymous> (node:electron/js2c/browser_init:2:88640)
satenshakya commented 8 months ago

TestLinuxFigma.zip Screenshot from 2024-01-15 19-47-07 Here is the sample project and error screenshot I'm getting in figma-linux app. @ChugunovRoman

ChugunovRoman commented 8 months ago

@satenshakya the "main" property should "src/code.js", but the plugin will not imports. I fixed that