fix: remove babel.config.js from init templates + website (#10514)

This commit is contained in:
Sébastien Lorber 2024-09-22 13:59:33 +02:00 committed by GitHub
parent 9ecff801ff
commit a5fd530ffc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 17 deletions

View file

@ -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",

View file

@ -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",

View file

@ -1,3 +0,0 @@
module.exports = {
presets: ['@docusaurus/babel/preset'],
};

View file

@ -1,10 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
module.exports = {
presets: ['@docusaurus/babel/preset'],
};

View file

@ -275,7 +275,15 @@ 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 {
@ -283,4 +291,4 @@ export default {
};
```
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.