Skip to content

Commit

Permalink
fix(gatsby-plugin-mdx): fix relative imports (#29775)
Browse files Browse the repository at this point in the history
  • Loading branch information
wardpeet authored Feb 25, 2021
1 parent 27adffe commit e79fc6b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/gatsby-plugin-mdx/gatsby/on-create-node.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require(`fs`)
const path = require(`path`)
const babel = require(`@babel/core`)
const { createContentDigest } = require(`gatsby-core-utils`)
const { createContentDigest, slash } = require(`gatsby-core-utils`)

const defaultOptions = require(`../utils/default-options`)
const {
Expand Down Expand Up @@ -221,9 +221,11 @@ class BabelPluginTransformRelativeImports {
const valueAbsPath = path.resolve(parentFilepath, nodePath)
const replacementPath =
loaders +
path.relative(
path.join(cache.directory, MDX_SCOPES_LOCATION),
valueAbsPath
slash(
path.relative(
path.join(cache.directory, MDX_SCOPES_LOCATION),
valueAbsPath
)
)
node.value = replacementPath
}
Expand Down

0 comments on commit e79fc6b

Please sign in to comment.