-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.js
41 lines (33 loc) · 1.09 KB
/
next.config.js
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
const findupSync = require('findup-sync');
const { existsSync } = require('fs');
const DOT_ENV_FILENAME = findupSync(['.env', '.env.local']);
const aliases = {
'@': __dirname,
'@components': `${__dirname}/components`,
'@lib': `${__dirname}/lib`,
'@pages': `${__dirname}/pages`,
};
/** @type {import('next').NextConfig} */
const nextConfig = {
cleanDistDir: true,
eslint: { ignoreDuringBuilds: true },
swcMinify: true,
optimizeFonts: true,
reactStrictMode: true,
//eslint-disable-next-line
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
if (existsSync(DOT_ENV_FILENAME)) {
if (DOT_ENV_FILENAME) {
const { parsed: myEnv } = require('dotenv').config({ path: DOT_ENV_FILENAME });
config.plugins.push(new webpack.EnvironmentPlugin(myEnv));
}
}
config.optimization.minimize = true;
config.resolve.alias = {
...(config.resolve.alias || {}),
...aliases,
};
return config;
},
};
module.exports = nextConfig;