@@ -105,9 +105,24 @@ It also exports the following identifier: `createLoader`.
105
105
106
106
Create a Node ESM loader to compile MDX to JS.
107
107
108
- ###### ` options `
108
+ ##### ` options `
109
109
110
110
` options ` are the same as [ ` compile ` from ` @mdx-js/mdx ` ] [ options ] .
111
+ One extra field is supported:
112
+
113
+ ###### ` options.fixRuntimeWithoutExportMap `
114
+
115
+ Fix broken export maps (` boolean ` , default: ` true ` ).
116
+
117
+ Several JSX runtimes, notably React below 18 and Emotion below 11.10.0, don’t
118
+ have a proper export map set up.
119
+ Export maps are needed to map ` xxx/jsx-runtime ` to an actual file in ESM.
120
+ This option fixes React et al by turning those into ` xxx/jsx-runtime.js ` .
121
+
122
+ > 👉 ** Note** : If you are using recent React, or other proper packages, you
123
+ > have to turn this field off.
124
+ > See the example below on how to configure your loader.
125
+ > Pass ` fixRuntimeWithoutExportMap: false ` in options to it.
111
126
112
127
###### Example
113
128
@@ -122,7 +137,7 @@ const {load, getFormat, transformSource} = createLoader(/* Options… */)
122
137
export {load , getFormat , transformSource }
123
138
```
124
139
125
- This example can then be used with ` node --experimental-loader=my-loader.js ` .
140
+ This example can then be used with ` node --experimental-loader=./ my-loader.js ` .
126
141
127
142
Node itself does not yet support multiple loaders but it is possible to combine
128
143
multiple loaders with [ ` @node-loader/core ` ] [ node-loader-core ] .
0 commit comments