feat: conditionally apply next-intl plugin and fix shared eslint ignore patterns
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user