-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.mjs
73 lines (65 loc) · 1.75 KB
/
next.config.mjs
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/// @ts-check
import process from "node:process";
import { withSentryConfig } from "@sentry/nextjs";
import nextPWA from "next-pwa";
import runtimeCaching from "next-pwa/cache.js";
import transpileModules from "next-transpile-modules";
import i18next from "./next-i18next.config.js";
const withTM = transpileModules(["@mui/material"]); // Pass the modules you would like to see transpiled
const withPWA = nextPWA({
disable: process.env.NODE_ENV === "development",
dest: "public",
register: true,
skipWaiting: true,
runtimeCaching,
buildExcludes: [/middleware-manifest.json$/],
});
/**
* Make sentry compatible for plugin composer
* @param nextConfig
* @returns {import('next').NextConfigFunction}
*/
function withSentry(nextConfig) {
return withSentryConfig(nextConfig, {
silent: true,
dryRun: process.env.VERCEL_ENV !== "production",
});
}
/**
*
* @param plugins
* @param {import('next').NextConfig} nextConfig
* @returns {import('next').NextConfigObject}
*/
function withPlugins(plugins, nextConfig) {
return plugins.reduce((previousValue, currentValue) => currentValue(previousValue), nextConfig);
}
/**
*
* @type {import('next').NextConfig} config
*/
const config = {
i18n: i18next.i18n,
reactStrictMode: true,
swcMinify: true,
productionBrowserSourceMaps: false,
compiler: {
// Allows to remove JSX properties. This is often used for testing.
// Similar to babel-plugin-react-remove-properties.
// To remove properties matching the default regex ^data-test:
// reactRemoveProperties: true,
},
images: {
remotePatterns: [
{
protocol: "https",
hostname: "images.unsplash.com",
},
],
formats: ["image/webp"],
},
sentry: {
hideSourceMaps: true,
},
};
export default withPlugins([withPWA, withTM, withSentry], config);