menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Switching ...
source image

Dev

6d

read

363

img
dot

Image Credit: Dev

Switching Next.js Compiler from Babel to SWC

  • Next.js provides built-in support for many core-js methods by default.
  • Running 'next build' generates an optimized version of your application for production.
  • The project plans to switch from using Babel to SWC as the compiler for Next.js.
  • There is an existing dependency on core-js and regenerator-runtime that needs evaluation.
  • A step-by-step guide is provided for transitioning from Babel to SWC in Next.js.
  • Solution 1 to remove Babel configuration faced issues due to Enzyme dependency.
  • Solution 2 involves using SWC for production and development, and Babel for testing.
  • Comparisons of bundle size, first load JS, and build time show SWC performing better than Babel.
  • To prevent fallback to using Babel, ensure no Babel configuration files are present in the production environment.
  • Adding console messages in the configuration files can help identify which compiler is being used.

Read Full Article

like

21 Likes

For uninterrupted reading, download the app