-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.babelrc.js
48 lines (44 loc) · 929 Bytes
/
.babelrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const { readFileSync } = require("fs")
const { join } = require("path")
const browsersList = readFileSync(
join(__dirname, ".browserslistrc"),
"utf8"
).split("\n")
const presets = [
[
"next/babel",
{
"preset-react": { runtime: "automatic", importSource: "theme-ui" },
"preset-env": {
targets: browsersList,
},
},
],
]
const mdxPresets = JSON.parse(JSON.stringify(presets))
// https://github.com/mdx-js/mdx/issues/1441
// MDX v1 uses the classic runtime and will complain about importSource
delete mdxPresets[0][1]["preset-react"].importSource
module.exports = {
presets,
plugins: [
["polished"],
["@emotion"],
[
"module-resolver",
{
root: ["."],
alias: {
"@": ".",
},
},
],
["./babel-plugin-nextjs-mdx-patch"],
],
overrides: [
{
test: /^.*\.mdx$/,
presets: mdxPresets,
},
],
}