Skip to content

Commit

Permalink
remove babel.config.js from init templates + website
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Sep 21, 2024
1 parent 9ecff80 commit 42500b1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"typecheck": "tsc"
},
"dependencies": {
"@docusaurus/babel": "3.5.2",
"@docusaurus/core": "3.5.2",
"@docusaurus/preset-classic": "3.5.2",
"@mdx-js/react": "^3.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/create-docusaurus/templates/classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/babel": "3.5.2",
"@docusaurus/core": "3.5.2",
"@docusaurus/preset-classic": "3.5.2",
"@mdx-js/react": "^3.0.0",
Expand Down
3 changes: 0 additions & 3 deletions packages/create-docusaurus/templates/shared/babel.config.js

This file was deleted.

10 changes: 0 additions & 10 deletions website/babel.config.js

This file was deleted.

12 changes: 10 additions & 2 deletions website/docs/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,20 @@ If you just want to use those fields on the client side, you could create your o

## Customizing Babel Configuration {#customizing-babel-configuration}

For new Docusaurus projects, we automatically generated a `babel.config.js` in the project root.
Docusaurus transpiles your site's source code using Babel by default. If you want to customize the Babel configuration, you can do so by creating a `babel.config.js` file in your project root.

To use the built-in preset as a base configuration, install the following package and use it

```bash npm2yarn
npm install --save @docusaurus/theme-live-codeblock
```

Then use the preset in your `babel.config.js` file:

```js title="babel.config.js"
export default {
presets: ['@docusaurus/babel/preset'],
};
```

Most of the time, this configuration will work just fine. If you want to customize your Babel configuration (e.g. to add support for Flow), you can directly edit this file. For your changes to take effect, you need to restart the Docusaurus dev server.
Most of the time, the default preset configuration will work just fine. If you want to customize your Babel configuration (e.g. to add support for Flow), you can directly edit this file. For your changes to take effect, you need to restart the Docusaurus dev server.

0 comments on commit 42500b1

Please sign in to comment.