martpie / next-transpile-modules

Next.js plugin to transpile code from node_modules. Please see: https://github.com/martpie/next-transpile-modules/issues/291
MIT License
1.13k stars 84 forks source link

Support SWC Loader #266

Closed ScriptedAlchemy closed 2 years ago

ScriptedAlchemy commented 2 years ago

Is your feature request related to a problem? Please describe. If i disable babel (delete the babel config) ill get "no loader for syntax" errors on my JSX in a monorepo

Describe the solution you'd like Looking at the source, it seems theres only babel support. Ideally if we see the swc-loader is in the config.module.rules, we switch over to SWC and pass along the issuer, includes modifications

Describe alternatives you've considered mutating webpack config manually, doing what you do but search for swc and patch the options

Additional context None

martpie commented 2 years ago

Is it actually possible to use SWC without Babel? I thought it went though it

ScriptedAlchemy commented 2 years ago

My bad it was my mistake. I forgot to add this

    if (typeof nextConfig.webpack === "function") {
      return nextConfig.webpack(config, options);
    }

So half the configs were not being applied. Yeah i was sure ive made this work before, anyways ill close it - user error!