Skip to content

Commit

Permalink
chore: clean up typings
Browse files Browse the repository at this point in the history
  • Loading branch information
axe312ger committed May 31, 2022
1 parent f40f8b6 commit b021c55
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/gatsby-plugin-mdx/src/gatsby-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ export const onCreateWebpackConfig: GatsbyNode["onCreateWebpackConfig"] = (
const fileMap = new Map()
fileNodes.forEach(fileNode => fileMap.set(fileNode.absolutePath, fileNode))

const loaderOptions: Options = {
useDynamicImport: true,
providerImportSource: `@mdx-js/react`,
}

const gatsbyLoaderOptions: IMdxLoaderOptions = {
fileMap,
pluginOptions: pluginOptions as IMdxPluginOptions,
}

actions.setWebpackConfig({
module: {
rules: [
Expand All @@ -30,17 +40,11 @@ export const onCreateWebpackConfig: GatsbyNode["onCreateWebpackConfig"] = (
loaders.js(),
{
loader: `@mdx-js/loader`,
options: {
useDynamicImport: true,
providerImportSource: `@mdx-js/react`,
} as Options,
options: loaderOptions,
},
{
loader: path.join(`gatsby-plugin-mdx`, `dist`, `mdx-loader`),
options: {
fileMap,
pluginOptions,
} as IMdxLoaderOptions,
options: gatsbyLoaderOptions,
},
],
},
Expand Down

0 comments on commit b021c55

Please sign in to comment.