Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a build-figma-plugin.main.js file throws an Unexpected token 'export' error when building #197

Closed
fwextensions opened this issue Oct 2, 2023 · 1 comment · Fixed by #201
Labels
bug Something isn't working

Comments

@fwextensions
Copy link

I followed the instructions for adding an esbuild config file and used the code described there, but running a build with a build-figma-plugin.main.js file logs this error:

error esbuild error
    Unexpected token 'export'

I believe that this line is using importFresh() to import the config file. But that seems to assume it's requiring a CJS module, so I don't see how that could import an exported ES module. If it's assuming CJS, then the build error makes sense.

@yuanqing yuanqing added the bug Something isn't working label Oct 17, 2023
@yuanqing
Copy link
Owner

Thanks for this. Can confirm that this is a bug / change in behavior caused by the latest version of esbuild. (The @create-figma-plugin/build package has tests to verify that both export default and module.exports syntax both work out-of-the-box.)

Am considering pinning certain dependencies to exact versions… 🤔

@yuanqing yuanqing mentioned this issue Oct 17, 2023
@yuanqing yuanqing linked a pull request Oct 17, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants