Skip to content

Commit

Permalink
fix(BREAKING-CHANGE): remove support migration from pages to app rout…
Browse files Browse the repository at this point in the history
…er (#80)
  • Loading branch information
aralroca authored Jan 22, 2024
1 parent f16ac79 commit af20d7a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,6 @@ function nextTranslate(nextConfig: NextConfig = {}): NextConfig {
revalidate = 0,
} = require(path.join(basePath, 'i18n')) as I18nConfig

let nextConfigWithI18n: NextConfig = {
...nextConfig,
i18n: {
locales,
defaultLocale,
domains,
localeDetection,
},
}

const pagesFolder = calculatePageDir('pages', pagesInDir, basePath)
const appFolder = calculatePageDir('app', pagesInDir, basePath)
const existLocalesFolder = existLocalesFolderWithNamespaces(basePath)
Expand All @@ -56,7 +46,7 @@ function nextTranslate(nextConfig: NextConfig = {}): NextConfig {

// Pages folder not found, so we're not using the loader
if (!existPagesFolder && !existPages(basePath, appFolder)) {
return nextConfigWithI18n
return nextConfig
}

if (existPagesFolder) {
Expand All @@ -82,6 +72,16 @@ function nextTranslate(nextConfig: NextConfig = {}): NextConfig {
}
}

let nextConfigWithI18n: NextConfig = hasAppJs ? nextConfig : {
...nextConfig,
i18n: {
locales,
defaultLocale,
domains,
localeDetection,
},
}

return {
...nextConfigWithI18n,
webpack(conf: webpack.Configuration, options) {
Expand Down

0 comments on commit af20d7a

Please sign in to comment.