Skip to content

Commit

Permalink
Dynamic imports for getDomainLocale
Browse files Browse the repository at this point in the history
  • Loading branch information
javivelasco committed May 30, 2022
1 parent 56ec1ed commit 4f31efc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/next/client/get-domain-locale.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { DomainLocale } from '../server/config'
import { normalizeLocalePath } from './normalize-locale-path'
import { detectDomainLocale } from './detect-domain-locale'
import type { normalizeLocalePath as NormalizeFn } from './normalize-locale-path'
import type { detectDomainLocale as DetectFn } from './detect-domain-locale'

const basePath = (process.env.__NEXT_ROUTER_BASEPATH as string) || ''

Expand All @@ -11,6 +11,11 @@ export function getDomainLocale(
domainLocales?: DomainLocale[]
) {
if (process.env.__NEXT_I18N_SUPPORT) {
const normalizeLocalePath: typeof NormalizeFn =
require('./normalize-locale-path').normalizeLocalePath
const detectDomainLocale: typeof DetectFn =
require('./detect-domain-locale').detectDomainLocale

const target = locale || normalizeLocalePath(path, locales).detectedLocale
const domain = detectDomainLocale(domainLocales, undefined, target)
if (domain) {
Expand Down

0 comments on commit 4f31efc

Please sign in to comment.