diff --git a/packages/gatsby/src/utils/worker/child.js b/packages/gatsby/src/utils/worker/child.js index 4fee51c9bbe0f..d8f378a435058 100644 --- a/packages/gatsby/src/utils/worker/child.js +++ b/packages/gatsby/src/utils/worker/child.js @@ -1,5 +1,7 @@ // Note: this doesn't check for conflicts between module exports +import { getFilePath } from "./page-data" + module.exports = { - ...require(`./page-data`), + getFilePath, ...require(`./render-html`), } diff --git a/packages/gatsby/src/utils/worker/page-data.js b/packages/gatsby/src/utils/worker/page-data.ts similarity index 52% rename from packages/gatsby/src/utils/worker/page-data.js rename to packages/gatsby/src/utils/worker/page-data.ts index 83c4acf9b8b67..9aee01ea1e2c0 100644 --- a/packages/gatsby/src/utils/worker/page-data.js +++ b/packages/gatsby/src/utils/worker/page-data.ts @@ -1,10 +1,9 @@ -const path = require(`path`) +import path from "path" -const getFilePath = ({ publicDir }, pagePath) => { +export const getFilePath = ( + { publicDir }: { publicDir: string }, + pagePath: string +): string => { const fixedPagePath = pagePath === `/` ? `index` : pagePath return path.join(publicDir, `page-data`, fixedPagePath, `page-data.json`) } - -module.exports = { - getFilePath, -}