File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
packages/gatsby-plugin-mdx/src Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,16 @@ export const onCreateWebpackConfig: GatsbyNode["onCreateWebpackConfig"] = (
2121 const fileMap = new Map ( )
2222 fileNodes . forEach ( fileNode => fileMap . set ( fileNode . absolutePath , fileNode ) )
2323
24+ const loaderOptions : Options = {
25+ useDynamicImport : true ,
26+ providerImportSource : `@mdx-js/react` ,
27+ }
28+
29+ const gatsbyLoaderOptions : IMdxLoaderOptions = {
30+ fileMap,
31+ pluginOptions : pluginOptions as IMdxPluginOptions ,
32+ }
33+
2434 actions . setWebpackConfig ( {
2535 module : {
2636 rules : [
@@ -30,17 +40,11 @@ export const onCreateWebpackConfig: GatsbyNode["onCreateWebpackConfig"] = (
3040 loaders . js ( ) ,
3141 {
3242 loader : `@mdx-js/loader` ,
33- options : {
34- useDynamicImport : true ,
35- providerImportSource : `@mdx-js/react` ,
36- } as Options ,
43+ options : loaderOptions ,
3744 } ,
3845 {
3946 loader : path . join ( `gatsby-plugin-mdx` , `dist` , `mdx-loader` ) ,
40- options : {
41- fileMap,
42- pluginOptions,
43- } as IMdxLoaderOptions ,
47+ options : gatsbyLoaderOptions ,
4448 } ,
4549 ] ,
4650 } ,
You can’t perform that action at this time.
0 commit comments