Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(BREAKING-CHANGE): remove support migration from pages to app router #80

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading