apollographql / graphql-tag

A JavaScript template literal tag that parses GraphQL queries
MIT License
2.32k stars 176 forks source link

SWC support #622

Open oreqizer opened 2 years ago

oreqizer commented 2 years ago

Will there be a SWC support?

hwillson commented 2 years ago

@oreqizer can you provide more details around what isn't currently working with SWC?

oreqizer commented 2 years ago

I meant if there is a SWC plugin planned with functionality like babel-plugin-graphql-tag, that it will be preprocessing them queries to ASTs

Gyv4ik commented 2 years ago

Are there any updates? My team uses NextJS + Apollo and SWC support blocks us from migrating the app from Babel to SWC.

lhguerra commented 1 year ago

+1 on the next limitation

Enalmada commented 1 year ago

I just learned about this when I added a .babelrc file to my next.js project as documented and saw this in my console

- info Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled

There seems to be a way to force swc on but I assume this isn't going to be compatible with babel-plugin-graphql-tag

module.exports = {
  experimental: {
    forceSwcTransforms: true,
  },
}

What is involved to get babel-plugin-graphql-tag swc compatible with next.js?

I also see this which might be the solution. I am so new to swc though I have no idea how to use it. https://github.com/rishabh3112/graphql-tag-swc-plugin

lhguerra commented 1 year ago

As far as I know you can't use SWC and Babel at the same time with Next, so both this force option and the plugin feel weird

rishabh3112 commented 11 months ago

the plugin feel weird

🥲

rishabh3112 commented 10 months ago

@Enalmada @lhguerra I think I have added majority of features needed for this, can you check this now? https://www.npmjs.com/package/graphql-tag-swc-plugin?activeTab=readme https://github.com/rishabh3112/graphql-tag-swc-plugin