Skip to content
Discussion options

You must be logged in to vote

Ways to Provide Transform Plugins in Next.js
SWC Plugins (Next.js Default Compiler)

Since Next.js uses SWC by default for compiling and transforming JS/TS, you can provide custom SWC plugins.

SWC plugins can be added via the next.config.js using the experimental SWC plugin API:

module.exports = {
  experimental: {
    swcPlugins: [
      ["path-to-plugin", { /* plugin options */ }]
    ],
  },
};

This is still experimental and evolving, so plugin ecosystem is limited compared to Babel.

Babel Plugins

Next.js still supports Babel, primarily via .babelrc or babel.config.js.

You can add Babel transform plugins here for JavaScript or TypeScript:

{
  "presets": ["next/babel"],
  "plugins": ["…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by apteryxxyz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants