File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
packages/babel-preset-gatsby/src Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -40,4 +40,17 @@ describe(`babel-preset-gatsby`, () => {
40
40
} ) ,
41
41
] )
42
42
} )
43
+
44
+ it ( `Allows to configure react importSource` , ( ) => {
45
+ const { presets } = preset ( null , {
46
+ reactImportSource : `@emotion/react` ,
47
+ } )
48
+
49
+ expect ( presets [ 1 ] ) . toEqual ( [
50
+ expect . stringContaining ( path . join ( `@babel` , `preset-react` ) ) ,
51
+ expect . objectContaining ( {
52
+ importSource : `@emotion/react` ,
53
+ } ) ,
54
+ ] )
55
+ } )
43
56
} )
Original file line number Diff line number Diff line change @@ -83,7 +83,9 @@ export default function preset(_, options = {}) {
83
83
: `React.createElement` ,
84
84
development : stage === `develop` ,
85
85
runtime : options . reactRuntime || `classic` ,
86
- importSource : options . reactImportSource ,
86
+ ...( options . reactImportSource
87
+ ? { importSource : options . reactImportSource }
88
+ : { } ) ,
87
89
} ,
88
90
] ,
89
91
] ,
You can’t perform that action at this time.
0 commit comments