-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
45 lines (38 loc) · 917 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
42
43
44
45
const _ = require("lodash");
const webpack = require("webpack");
const withPWA = require("next-pwa");
const plugins = [];
if (process.env.NODE_ENV === "production") {
plugins.unshift(withPWA);
}
module.exports = _.flow(...plugins)({
pwa: {
dest: "public",
},
serverRuntimeConfig: {
IS_SERVER: true,
},
webpack(config, { isServer }) {
config.module.rules.push({
test: /\.(gif|jpg|jpeg|png|svg|ttf|eot|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: [
{
loader: "file-loader",
options: {
publicPath: "/_next/static/images",
outputPath: "static/images",
},
},
],
});
// compile time config
config.plugins.push(
new webpack.DefinePlugin({
"process.env.ENVIRONMENT": JSON.stringify(
isServer ? "server" : "client"
),
})
);
return config;
},
});