yuanqing / create-figma-plugin

:battery: The comprehensive toolkit for developing plugins and widgets for Figma and FigJam
https://yuanqing.github.io/create-figma-plugin/
MIT License
948 stars 91 forks source link

esbuild error: could not resolve "@create-figma-plugin/utilities" #216

Closed parkersweb closed 9 months ago

parkersweb commented 10 months ago

Hi there,

My plugin recently started failing on both watch and build with the following error:

info Building...
error esbuild error
    Build failed with 1 error:
    src/main.ts:1:29: ERROR: Could not resolve "@create-figma-plugin/utilities"

In trying to chase down the cause of the problem - I've run npx --yes create-figma-plugin to create entirely fresh plugins using both the preact-rectangles and the preact-tailwindcss templates and both of those fail with the same error.

I'm using node Node v20.9

Does anyone have any suggestions as to what might be the cause? Thanks so much!

yuanqing commented 9 months ago

I can’t seem to reproduce this issue on my machine (node v20 on a Mac). Have you tried bootstrapping using npx --yes create-figma-plugin@latest

parkersweb commented 9 months ago

Yeah - still gives the same error 😬

I installed node 20 through nvm - on Sonoma 14.2. Does that match your setup? Slightly stumped at the moment!

yuanqing commented 9 months ago

So strange

I installed node 20 through nvm - on Sonoma 14.2

Same except that I’m on 14.1. I doubt it’s something to do with the OS

parkersweb commented 9 months ago

Just in case anyone stumbles across this in future - I spent a fair bit stripping the project back to basics, then trying a simpler basic esbuild project. The cause of the problem turned out to be the existence of a yarn pnp.js file in the parent directory causing esbuild to try using that even though yarn isn't installed/enabled. Once that file has been removed the figma plugin builds again without errors.

Thanks so much for you help!