graphql-tag icon indicating copy to clipboard operation
graphql-tag copied to clipboard

SWC support

Open oreqizer opened this issue 3 years ago • 8 comments

Will there be a SWC support?

oreqizer avatar Jun 29 '22 16:06 oreqizer

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

hwillson avatar Jul 01 '22 16:07 hwillson

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

oreqizer avatar Jul 02 '22 18:07 oreqizer

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

Gyv4ik avatar Sep 01 '22 11:09 Gyv4ik

+1 on the next limitation

lhguerra avatar May 08 '23 22:05 lhguerra

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

Enalmada avatar Jun 11 '23 23:06 Enalmada

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

lhguerra avatar Jun 12 '23 21:06 lhguerra

the plugin feel weird

🥲

rishabh3112 avatar Nov 27 '23 16:11 rishabh3112

@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

rishabh3112 avatar Dec 12 '23 07:12 rishabh3112