Back to Next Js

Using a custom Babel config

examples/with-custom-babel-config/README.md

16.2.51.4 KB
Original Source

Using a custom Babel config

This example features:

  • An app using proposed do expressions.
  • It uses babel-preset-stage-0, which allows us to use above JavaScript feature.
  • It uses '.babelrc' file in the app directory to add above preset.

Most of the time, when writing a custom .babelrc file, you need to add next/babel as a preset.

Deploy your own

How to use

Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:

bash
npx create-next-app --example with-custom-babel-config with-custom-babel-config-app
bash
yarn create next-app --example with-custom-babel-config with-custom-babel-config-app
bash
pnpm create next-app --example with-custom-babel-config with-custom-babel-config-app

Deploy it to the cloud with Vercel (Documentation).