-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
35 lines (31 loc) · 893 Bytes
/
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
const { PHASE_DEVELOPMENT_SERVER } = require("next/constants");
const path = require("path");
const config = (phase) => {
let plugins = [];
let settings = {
reactStrictMode: true,
webpack: (config) => {
config.resolve.alias = {
...config.resolve.alias,
"@": path.join(__dirname, "src"),
"@public": path.join(__dirname, "public"),
};
return config;
},
};
if (phase !== PHASE_DEVELOPMENT_SERVER) {
// do something in production mode
}
return {
plugins,
settings,
};
};
module.exports = {
assetPrefix: ".",
};
const pipe = (funcs) => (value) => funcs.reduce((v, f) => f(v), value);
module.exports = (phase, { defaultConfig }) => {
const cfg = config(phase, { defaultConfig });
return pipe(cfg.plugins)(cfg.settings);
};