-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
63 lines (59 loc) · 1.61 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// @ts-nocheck
/** @type {import('next').NextConfig} */
const withLess = require("next-with-less");
const { PHASE_DEVELOPMENT_SERVER } = require("next/constants");
const generateBuildId = async () => {
if (process.env.BUILD_ID) {
return process.env.BUILD_ID;
} else {
return `${new Date().getTime()}`;
}
};
module.exports = module.exports = (phase, { _defaultConfig }) => {
const commonConfigs = {
compiler: {
styledComponents: {
// Enabled by default in development, disabled in production to reduce file size,
// setting this will override the default for all environments.
displayName: true,
// Enabled by default.
ssr: true,
},
},
reactStrictMode: true,
devIndicators: {
buildActivity: false,
},
webpack: (
config,
{ _buildId, _dev, _isServer, _defaultLoaders, _nextRuntime, _webpack }
) => {
config.module.rules.push({
test: /\.ya?ml$/,
type: "json",
use: "yaml-loader",
});
config.module.rules.push({
test: /\.svg$/,
use: "@svgr/webpack",
});
config.experiments = { asyncWebAssembly: true };
// Important: return the modified config
return config;
},
};
if (phase === PHASE_DEVELOPMENT_SERVER) {
/* development only config options here */
return withLess({
lessLoaderOptions: {},
...commonConfigs,
});
}
/* config options for all phases except development here */
return withLess({
lessLoaderOptions: {},
...commonConfigs,
distDir: "build",
generateBuildId: generateBuildId,
});
};