atlassian-labs / compiled

A familiar and performant compile time CSS-in-JS library for React.
https://compiledcssinjs.com
Apache License 2.0
1.99k stars 67 forks source link

[Feature Request] Provide babel configuration through webpack loader config #1171

Closed SukkaW closed 2 years ago

SukkaW commented 2 years ago

Is your feature request related to a problem? Please describe.

The feature request is similar to #1143.

Next.js 12 internally uses swc based compiler, too. However, in order for compiled's babel.parseAsync to recognize tsx files, I need @babel/plugin-syntax-typescript and @babel/plugin-syntax-jsx.

Currently, compiled will let babel load the config through files. But if I supplement a .babelrc, Next.js will automatically fall back to babel for compiling.

In order to leverage Next.js's swc compiler, the absence of any babel configuration file is required.

Describe the solution you'd like

Add babel to compiled-loader's configuration, so I can provide babel configuration directly, without any .babelrc files.

filiphsps commented 1 year ago

Hey @SukkaW, sorry for resurrecting a dead issue 😅

Did you manage to get a working setup where SWC support was maintained instead of having to fall back to babel? I've been fighting with the configuration for a few hrs and can't seem to get it to play nicely with each other. If so it'd be awesome if you could share just the webpack part of the next.config 💯

Thanks!