File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
packages/babel-preset-gatsby/src Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,16 @@ export default function preset(_, options = {}) {
50
50
}
51
51
}
52
52
53
+ let importSource = undefined
54
+
55
+ if ( options . reactImportSource && options . reactRuntime !== `automatic` ) {
56
+ throw Error (
57
+ `\`@babel/preset-react\` requires reactRuntime \`automatic\` in order to use \`importSource\`.`
58
+ )
59
+ } else if ( options . reactImportSource ) {
60
+ importSource = options . reactImportSource
61
+ }
62
+
53
63
return {
54
64
presets : [
55
65
[
@@ -83,9 +93,7 @@ export default function preset(_, options = {}) {
83
93
: `React.createElement` ,
84
94
development : stage === `develop` ,
85
95
runtime : options . reactRuntime || `classic` ,
86
- ...( options . reactImportSource
87
- ? { importSource : options . reactImportSource }
88
- : { } ) ,
96
+ importSource,
89
97
} ,
90
98
] ,
91
99
] ,
You can’t perform that action at this time.
0 commit comments