forked from VulcanJS/vulcan-next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
77 lines (73 loc) · 1.57 KB
/
babel.config.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const plugins = [
// @see https://mui.com/guides/minimizing-bundle-size/
[
"babel-plugin-import",
{
libraryName: "@mui/material",
libraryDirectory: "",
camel2DashComponentName: false,
},
"core",
],
[
"babel-plugin-import",
{
libraryName: "@mui/icons-material",
libraryDirectory: "",
camel2DashComponentName: false,
},
"icons",
],
// @see https://github.com/ant-design/babel-plugin-import
[
"babel-plugin-import",
{
libraryName: "lodash",
libraryDirectory: "",
camel2DashComponentName: false, // default: true
},
],
];
// We need babel for code instrumentation
const enableCoverage = process.env.COVERAGE && process.env.COVERAGE !== "false";
if (enableCoverage) {
const debug = require("debug")("coverage");
debug("Enabling istanbul plugin in babel"); // eslint-disable-line no-console
plugins.push("istanbul");
}
// Add support of styled components
/*
plugins.push([
"styled-components",
{
ssr: true,
displayName: true,
preprocess: false,
},
]);
*/
// // Fixe for pragmaFrag issue @see https://github.com/vercel/next.js/issues/11230
// plugins.push([
// "@babel/plugin-transform-react-jsx",
// {
// runtime: "classic",
// },
// ]);
module.exports = {
// we also need next/babel preset to work with Next
presets: [
[
"next/babel",
{
"styled-jsx": {
plugins: ["styled-jsx-plugin-postcss"],
},
"preset-react": {
runtime: "classic",
},
},
],
],
plugins,
babelrc: false,
};