-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.mjs
53 lines (44 loc) · 1.36 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
// import {PrettyCodeOptions} from 'rehype-pretty-code/types';
/** @type {import('next').NextConfig} */
// const isProd = process.env.NODE_ENV === 'production';
// const nextConfig = {
// pageExtensions: ['js', 'jsx', 'mdx', 'md', 'ts', 'tsx'],
// // output: isProd? 'export': 'standalone',
// // distDir: isProd? "out": ".next",
// webpack: config => {
// config.module.rules.push({
// test: /\.svg$/,
// use: ["@svgr/webpack"],
// });
// return config;
// },
// transpilePackages: ['next-mdx-remote']
// };
// if(isProd){
// nextConfig.output = 'export'
// nextConfig.distDir = 'out'
// }
// export default nextConfig;
import { PHASE_PRODUCTION_BUILD, PHASE_EXPORT } from "next/constants.js"
const nextConfig = (phase, { defaultConfig }) => {
const baseconfig = {
webpack: (config) => {
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
})
return config
},
}
if (phase === PHASE_PRODUCTION_BUILD | phase === PHASE_EXPORT) {
console.log("This is Deployment Server!")
baseconfig["output"] = "export"
baseconfig['images'] = {
deviceSizes: [180, 640, 750, 828, 900, 1080, 1200, 1920, 2048, 3840],
loader: 'custom',
loaderFile: "./imageLoader.js",
}
}
return baseconfig
};
export default nextConfig;