-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
41 lines (36 loc) · 1001 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
36
37
38
39
40
41
const fs = require("fs");
const path = require("path");
const { promisify } = require("util");
const copyFile = promisify(fs.copyFile);
const filesToExport = ["404.html"];
module.exports = {
exportPathMap: async function(
defaultPathMap,
{ dev, dir, outDir, distDir, buildId }
) {
const defaultMap = Object.assign(
{
"/": { page: "/" },
"/about": { page: "/about" },
"/quotes-list": { page: "/quotes-list" },
"/error": { page: "/_error" }
},
);
if (dev) {
return defaultMap;
}
// Copies the files from your project root into the out directory
filesToExport.forEach(async file => {
await copyFile(path.join(dir, file), path.join(outDir, file));
});
// This will copy sitemap.xml from your project root into the out directory
return defaultMap;
},
webpack: config => {
// Fixes npm packages that depend on `fs` module
config.node = {
fs: 'empty'
}
return config
}
}