-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
77 lines (67 loc) · 2 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const path = require("path");
// const Dotenv = require("dotenv");
// const DotenvWebPack = require("dotenv-webpack");
const CMSApi = require("./utility/cms");
const generateSitemap = require("./scripts/sitemap-gen");
const next_config = {
// target: "serverless",
trailingSlash: true,
sassOptions: {
includePaths: [path.join(__dirname, "styles")],
},
i18n: {
locales: ["en"],
defaultLocale: "en",
},
distDir: "out_publish",
exportPathMap: async function () {
const paths = {
"/": { page: "/" },
"/our-work": { page: "/our-work" },
"/our-services": { page: "/our-services" },
"/about-us": { page: "/about-us" },
"/contact": { page: "/contact" },
"/careers": { page: "/careers" },
};
const api = new CMSApi();
const workPages = await api.fetchContentPages("pageWork");
workPages.forEach((page) => {
console.log(page.fields.slug);
paths[`/our-work/${page.fields.slug}`] = {
page: "/our-work/[slug]",
query: { slug: page.fields.slug },
};
});
const servicePages = await api.fetchContentPages("pageService");
servicePages.forEach((page) => {
console.log(page.fields.slug);
paths[`/our-services/${page.fields.slug}`] = {
page: "/our-services/[slug]",
query: { slug: page.fields.slug },
};
});
// generate the sitemap now that we have all the paths
// can add more fields here if we want to customize it a bit more
generateSitemap(paths);
return paths;
},
webpack: (config) => {
config.plugins = config.plugins || [];
// config.plugins.push(
// new DotenvWebPack({
// path: path.join(__dirname, ".env"),
// systemvars: true,
// })
// );
// config.plugins = [
// // Read the .env file
// new DotenvWebPack({
// path: path.join(__dirname, ".env"),
// systemvars: true,
// }),
// ...config.plugins,
// ];
return config;
},
};
module.exports = { ...next_config };