-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.mjs
More file actions
53 lines (47 loc) · 1.49 KB
/
Copy pathnext.config.mjs
File metadata and controls
53 lines (47 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { withSentryConfig } from "@sentry/nextjs";
import ContentSecurityPolicy from "./csp.config.mjs";
const pkg = await import("./package.json", { with: { type: "json" } });
const version = pkg.default.version;
/** @type {import('next').NextConfig} */
const moduleExports = {
basePath: process.env.NEXT_PUBLIC_BASE_PATH || undefined,
crossOrigin: "anonymous",
pageExtensions: ["js", "jsx", "ts", "tsx"],
poweredByHeader: false,
bundlePagesRouterDependencies: true,
reactStrictMode: process.env.NODE_ENV !== "production",
images: {
remotePatterns: [
...(process.env.DOCS_CMS_URL
? [new URL(process.env.DOCS_CMS_URL.replace(/\/+$/, "") + "/**")]
: []),
{ protocol: "https", hostname: "**.gouv.fr", pathname: "/**" },
],
},
webpack: (config) => {
config.module.rules.push({
test: /\.(woff2|webmanifest)$/,
type: "asset/resource",
});
return config;
},
env: {
NEXT_PUBLIC_APP_VERSION: version,
NEXT_PUBLIC_APP_VERSION_COMMIT: process.env.GITHUB_SHA || process.env.CONTAINER_VERSION,
CONTENT_SECURITY_POLICY: ContentSecurityPolicy,
},
onDemandEntries: {
maxInactiveAge: 24 * 3600 * 1000,
pagesBufferLength: 100,
},
transpilePackages: ["@codegouvfr/react-dsfr", "tss-react"],
async headers() {
return [
{
source: "/:path*",
headers: [{ key: "Cross-Origin-Opener-Policy", value: "same-origin" }],
},
];
},
};
export default withSentryConfig(moduleExports, { silent: true });