README.md 1.6 KB
Newer Older
1 2
# Using a custom Babel config

3 4 5 6 7 8 9 10
This example features:

- An app using proposed [do expressions](https://babeljs.io/docs/plugins/transform-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.

11 12
## Deploy your own

T
Tim Neutkens 已提交
13
Deploy the example using [Vercel](https://vercel.com):
14

15
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/vercel/next.js/tree/canary/examples/with-custom-babel-config)
16

17 18 19 20
## How to use

### Using `create-next-app`

21
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
22 23

```bash
24
npx create-next-app --example with-custom-babel-config with-custom-babel-config-app
25 26 27 28 29
# or
yarn create next-app --example with-custom-babel-config with-custom-babel-config-app
```

### Download manually
30

31
Download the example:
D
Dan Zajdband 已提交
32 33

```bash
34
curl https://codeload.github.com/vercel/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-custom-babel-config
D
Dan Zajdband 已提交
35 36 37 38 39 40 41 42
cd with-custom-babel-config
```

Install it and run:

```bash
npm install
npm run dev
43 44 45
# or
yarn
yarn dev
D
Dan Zajdband 已提交
46 47
```

T
Tim Neutkens 已提交
48
Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).