diff --git a/client/gatsby-config.js b/client/gatsby-config.js index 19a51798cc5..8a5b45d1d7c 100644 --- a/client/gatsby-config.js +++ b/client/gatsby-config.js @@ -5,11 +5,11 @@ const { replaceChallengeNodes, localeChallengesRootDir } = require('./utils/build-challenges'); +const { pathPrefix } = require('./utils/gatsby/path-prefix'); -const { clientLocale, curriculumLocale, homeLocation } = envData; +const { curriculumLocale, homeLocation } = envData; const curriculumIntroRoot = path.resolve(__dirname, './src/pages'); -const pathPrefix = clientLocale === 'english' ? '' : '/' + clientLocale; module.exports = { flags: { diff --git a/client/src/templates/Challenges/utils/frame.ts b/client/src/templates/Challenges/utils/frame.ts index 6151c2a9758..da7a051a5a1 100644 --- a/client/src/templates/Challenges/utils/frame.ts +++ b/client/src/templates/Challenges/utils/frame.ts @@ -12,6 +12,7 @@ import type { PythonDocument } from '../../../../../tools/client-plugins/browser-scripts'; import { Hooks } from '../../../redux/prop-types'; +import { pathPrefix } from '../../../../utils/gatsby/path-prefix'; export const helperVersion = _helperVersion; @@ -85,7 +86,7 @@ export const scrollManager = new ScrollManager(); export const mainPreviewId = 'fcc-main-frame'; // the project preview frame demos the finished project export const projectPreviewId = 'fcc-project-preview-frame'; -const ASSET_PATH = `/js/test-runner/${helperVersion}/`; +const ASSET_PATH = `${pathPrefix}/js/test-runner/${helperVersion}/`; const DOCUMENT_NOT_FOUND_ERROR = 'misc.document-notfound'; diff --git a/client/utils/gatsby/path-prefix.js b/client/utils/gatsby/path-prefix.js new file mode 100644 index 00000000000..2be9f18cc42 --- /dev/null +++ b/client/utils/gatsby/path-prefix.js @@ -0,0 +1,5 @@ +const envData = require('../../config/env.json'); + +const { clientLocale } = envData; + +exports.pathPrefix = clientLocale === 'english' ? '' : '/' + clientLocale;