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

Plugin causes error when deploying graphql playground #4

Closed
mmgj opened this issue Apr 14, 2022 · 3 comments · Fixed by #5
Closed

Plugin causes error when deploying graphql playground #4

mmgj opened this issue Apr 14, 2022 · 3 comments · Fixed by #5
Labels
enhancement New feature or request

Comments

@mmgj
Copy link

mmgj commented Apr 14, 2022

Having this plugin installed will cause the following error when running the CLI command sanity graphql deploy:

/path to project/node_modules/sanity-plugin-tags/lib/schemas/tags.js:1
import t from"part:tags/components/input";const e={name:"tags",title:"Tags",type:"array",inputComponent:t,of:[{type:"tag"}]};export{e as default};
^^^^^^
SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1031:15)
    at Module._compile (node:internal/modules/cjs/loader:1065:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)

This seems to be the same issue mentioned in this thread on the Sanity Exchange, which ultimately appears to have been solved in this pull request to the original plugin repo.

@pcbowers pcbowers added the enhancement New feature or request label Apr 15, 2022
@pcbowers
Copy link
Owner

@mmgj This is because I bundle my plugin, but I only transpile it down to ES2015 (ES6). Graphql requires ES5. Thank you for linking the pull request and thread, that helped me find the source of the error!

I'll see what it takes to add another step to my build process to support ES5 transpiling.

@pcbowers
Copy link
Owner

Let me know if you still have problems! I just updated the package with this support.

@mmgj
Copy link
Author

mmgj commented Apr 19, 2022

Just updated, and now deploys graphql as expected. Thanks for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants