Skip to content

Commit e79fc6b

Browse files
authored
fix(gatsby-plugin-mdx): fix relative imports (#29775)
1 parent 27adffe commit e79fc6b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/gatsby-plugin-mdx/gatsby/on-create-node.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const fs = require(`fs`)
22
const path = require(`path`)
33
const babel = require(`@babel/core`)
4-
const { createContentDigest } = require(`gatsby-core-utils`)
4+
const { createContentDigest, slash } = require(`gatsby-core-utils`)
55

66
const defaultOptions = require(`../utils/default-options`)
77
const {
@@ -221,9 +221,11 @@ class BabelPluginTransformRelativeImports {
221221
const valueAbsPath = path.resolve(parentFilepath, nodePath)
222222
const replacementPath =
223223
loaders +
224-
path.relative(
225-
path.join(cache.directory, MDX_SCOPES_LOCATION),
226-
valueAbsPath
224+
slash(
225+
path.relative(
226+
path.join(cache.directory, MDX_SCOPES_LOCATION),
227+
valueAbsPath
228+
)
227229
)
228230
node.value = replacementPath
229231
}

0 commit comments

Comments
 (0)