Skip to content

Commit 70e95c6

Browse files
committed
Refactor add-base-babel-config.ts to export base babel config
1 parent 564df3a commit 70e95c6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
import { writeJsonFile } from "../../../helpers/json-files"
1+
import { promises as fs } from "fs"
22
import { Step } from "../../step"
33

4+
const baseBabelConfig = {
5+
presets: [["next/babel", {}]],
6+
plugins: [],
7+
}
8+
export const baseBabelConfigString = JSON.stringify(baseBabelConfig, null, 2)
9+
410
export const addBaseBabelConfigStep: Step = {
511
description: "adding custom Babel configuration",
612

@@ -10,9 +16,6 @@ export const addBaseBabelConfigStep: Step = {
1016

1117
run: async () => {
1218
// The base Babel config is ready for custom preset configurations to be added onto the `next/babel` preset as per the Next.js docs: https://nextjs.org/docs/advanced-features/customizing-babel-config
13-
await writeJsonFile(".babelrc", {
14-
presets: [["next/babel", {}]],
15-
plugins: [],
16-
})
19+
await fs.writeFile(".babelrc", baseBabelConfigString)
1720
},
1821
}

0 commit comments

Comments
 (0)