init
This commit is contained in:
16
packages/next-config/README.md
Normal file
16
packages/next-config/README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# @mintel/next-config
|
||||
|
||||
Shared Next.js configuration wrapper for Mintel projects. Integrates `next-intl` and Sentry by default.
|
||||
|
||||
## Usage
|
||||
|
||||
In your `next.config.ts`:
|
||||
```typescript
|
||||
import mintelNextConfig from "@mintel/next-config";
|
||||
|
||||
const nextConfig = {
|
||||
// Your project specific config
|
||||
};
|
||||
|
||||
export default mintelNextConfig(nextConfig);
|
||||
```
|
||||
46
packages/next-config/index.js
Normal file
46
packages/next-config/index.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import createNextIntlPlugin from 'next-intl/plugin';
|
||||
import { withSentryConfig } from '@sentry/nextjs';
|
||||
|
||||
const withNextIntl = createNextIntlPlugin();
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
export const baseNextConfig = {
|
||||
output: 'standalone',
|
||||
images: {
|
||||
dangerouslyAllowSVG: true,
|
||||
contentDispositionType: 'attachment',
|
||||
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
|
||||
},
|
||||
async rewrites() {
|
||||
const umamiUrl = (process.env.NEXT_PUBLIC_UMAMI_SCRIPT_URL || 'https://analytics.infra.mintel.me').replace('/script.js', '');
|
||||
const glitchtipUrl = process.env.SENTRY_DSN
|
||||
? new URL(process.env.SENTRY_DSN).origin
|
||||
: 'https://errors.infra.mintel.me';
|
||||
|
||||
return [
|
||||
{
|
||||
source: '/stats/:path*',
|
||||
destination: `${umamiUrl}/:path*`,
|
||||
},
|
||||
{
|
||||
source: '/errors/:path*',
|
||||
destination: `${glitchtipUrl}/:path*`,
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
export default (config) => {
|
||||
const nextIntlConfig = withNextIntl({ ...baseNextConfig, ...config });
|
||||
|
||||
return withSentryConfig(
|
||||
nextIntlConfig,
|
||||
{
|
||||
silent: !process.env.CI,
|
||||
treeshake: { removeDebugLogging: true },
|
||||
},
|
||||
{
|
||||
authToken: undefined,
|
||||
}
|
||||
);
|
||||
};
|
||||
14
packages/next-config/package.json
Normal file
14
packages/next-config/package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "@mintel/next-config",
|
||||
"version": "1.0.0",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://npm.infra.mintel.me"
|
||||
},
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"next-intl": "^3.0.0",
|
||||
"@sentry/nextjs": "^8.0.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user