-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
51 lines (45 loc) · 1.38 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
/** @type {import('next').NextConfig} */
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
/**
* Standalone mode needs to be enabled for Docker builds.
* https://nextjs.org/docs/pages/api-reference/next-config-js/output
* */
const isStandalone = process.env.STANDALONE === 'true';
const nextConfig = {
reactStrictMode: false,
sassOptions: {
includePaths: [path.join(__dirname, 'styles')],
},
webpack: (config, { dev }) => {
if (dev) {
// Silencing warnings about missing dependencies in development.
// https://dev.to/dinhkhai0201/module-not-found-cant-resolve-pino-pretty-g6
config.resolve.fallback = { fs: false, net: false, tls: false };
config.externals.push('pino-pretty', 'encoding');
}
return config;
},
experimental: {
//https://vercel.com/blog/how-we-optimized-package-imports-in-next-js#what's-the-problem-with-barrel-files
optimizePackageImports: ['@mui/material'],
},
};
const standaloneConfig = {
output: 'standalone',
experimental: {
outputFileTracingRoot: path.join(__dirname, '../../'),
},
};
const finalConfig = isStandalone
? {
...nextConfig,
...standaloneConfig,
experimental: {
...nextConfig.experimental,
...standaloneConfig.experimental,
},
}
: nextConfig;
export default finalConfig;