Skip to content

Commit 39ead3d

Browse files
committed
add @babel/preset-react to the webpack config
1 parent 5ea45d4 commit 39ead3d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

webpack.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,19 @@ module.exports = (env) => {
106106
// targets: "",
107107
},
108108
],
109+
// The react preset includes plugins that are required for React
110+
// apps. For example, it inclues a plugin that transforms JSX.
111+
[
112+
"@babel/preset-react",
113+
{
114+
// Tell "plugin-transform-react-jsx" which runtime to use.
115+
// The "automatic" runtime will:
116+
// * Import the jsx() function in your JSX files:
117+
// `import { jsx as _jsx } from "react";`
118+
// * Transform JSX: `<div />` to `_jsx("div")`
119+
runtime: "automatic",
120+
},
121+
],
109122
],
110123
},
111124
},

0 commit comments

Comments
 (0)