-
Notifications
You must be signed in to change notification settings - Fork 7
/
next.config.js
96 lines (88 loc) · 2.5 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
const { PHASE_PRODUCTION_SERVER } =
process.env.NODE_ENV === "development"
? {} // We're never in "production server" phase when in development mode
: !process.env.NOW_REGION
? require("next/constants") // Get values from `next` package when building locally
: require("next-server/constants"); // Get values from `next-server` package when building on now v2
module.exports = (phase, { defaultConfig }) => {
if (phase === PHASE_PRODUCTION_SERVER) {
// Config used to run in production.
return {};
}
/* eslint-disable */
const withCSS = require("@zeit/next-css");
const withLess = require("@zeit/next-less");
const lessToJS = require("less-vars-to-js");
// const withOffline = require('next-offline')
const withManifest = require("next-manifest");
const fs = require("fs");
const path = require("path");
// Where your antd-custom.less file lives
const themeVariables = lessToJS(
fs.readFileSync(path.resolve(__dirname, "./styles/antd.less"), "utf8")
);
// fix: prevents error when .less files are required by node
if (typeof require !== "undefined") {
require.extensions[".less"] = file => { };
}
// ! PWA configurations
const manifest = {
output: "./static",
name: "NextStore",
icons: [
{
src: "/images/logo.png",
sizes: "64x64",
type: "image/png"
},
{
src: "/images/logo2.png",
sizes: "144x144",
type: "image/png"
}
]
};
// const nextConfig = {
// target: "serverless",
// // generateInDevMode: true,
// // transformManifest: manifest => ['/'].concat(manifest),
// workboxOpts: {
// swDest: "static/service-worker.js",
// runtimeCaching: [
// {
// urlPattern: /^https?.*/,
// handler: "networkFirst",
// options: {
// cacheName: "https-calls",
// networkTimeoutSeconds: 15,
// expiration: {
// maxEntries: 150,
// maxAgeSeconds: 7 * 24 * 60 * 60 // 1 week
// },
// cacheableResponse: {
// statuses: [0, 200]
// }
// }
// }
// ]
// }
// };
return withManifest(
// withOffline(
withCSS(
withLess(
{
lessLoaderOptions: {
javascriptEnabled: true,
modifyVars: themeVariables
},
manifest: {
...manifest
}
// ...nextConfig
}
// )
)
)
);
};