Skip to content

Commit b021c55

Browse files
committed
chore: clean up typings
1 parent f40f8b6 commit b021c55

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

packages/gatsby-plugin-mdx/src/gatsby-node.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff 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
},

0 commit comments

Comments
 (0)