feat: conditionally apply next-intl plugin and fix shared eslint ignore patterns
This commit is contained in:
@@ -13,10 +13,14 @@ export const nextConfig = [
|
||||
{
|
||||
ignores: [
|
||||
"**/dist/**",
|
||||
"**/build/**",
|
||||
"**/out/**",
|
||||
"**/coverage/**",
|
||||
"**/.next/**",
|
||||
"**/node_modules/**",
|
||||
"**/.gitea/**",
|
||||
"**/.changeset/**",
|
||||
"**/.vercel/**",
|
||||
],
|
||||
},
|
||||
...compat.extends("next/core-web-vitals", "next/typescript"),
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"clsx": "^2.1.1",
|
||||
"lucide-react": "^0.474.0",
|
||||
"next": "15.1.6",
|
||||
"next-intl": "^3.26.5",
|
||||
"next-intl": "^4.8.2",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"tailwind-merge": "^2.6.0"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import createNextIntlPlugin from "next-intl/plugin";
|
||||
import { withSentryConfig } from "@sentry/nextjs";
|
||||
|
||||
const withNextIntl = createNextIntlPlugin();
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
export const baseNextConfig = {
|
||||
@@ -34,10 +34,30 @@ export const baseNextConfig = {
|
||||
};
|
||||
|
||||
const withMintelConfig = (config) => {
|
||||
const nextIntlConfig = withNextIntl({ ...baseNextConfig, ...config });
|
||||
const i18nPaths = [
|
||||
"src/i18n/request.ts",
|
||||
"src/i18n/request.tsx",
|
||||
"i18n/request.ts",
|
||||
"i18n/request.tsx",
|
||||
"src/i18n.ts",
|
||||
"src/i18n.tsx",
|
||||
"i18n.ts",
|
||||
"i18n.tsx",
|
||||
];
|
||||
|
||||
const hasI18nConfig = i18nPaths.some((p) =>
|
||||
fs.existsSync(path.resolve(process.cwd(), p)),
|
||||
);
|
||||
|
||||
let nextConfig = { ...baseNextConfig, ...config };
|
||||
|
||||
if (hasI18nConfig) {
|
||||
const withNextIntl = createNextIntlPlugin();
|
||||
nextConfig = withNextIntl(nextConfig);
|
||||
}
|
||||
|
||||
return withSentryConfig(
|
||||
nextIntlConfig,
|
||||
nextConfig,
|
||||
{
|
||||
silent: !process.env.CI,
|
||||
treeshake: { removeDebugLogging: true },
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"next-intl": "^3.0.0",
|
||||
"next-intl": "^4.8.2",
|
||||
"@sentry/nextjs": "^8.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"dependencies": {
|
||||
"@directus/sdk": "^21.0.0",
|
||||
"next": "15.1.6",
|
||||
"next-intl": "^3.0.0",
|
||||
"next-intl": "^4.8.2",
|
||||
"zod": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Reference in New Issue
Block a user