-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
43 lines (40 loc) · 1.22 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
const withCSS = require('@zeit/next-css');
const withSass = require('@zeit/next-sass');
const withImages = require('next-images');
const webpack = require("webpack");
// Initialize doteenv library
require("dotenv").config();
module.exports =
withCSS(
withSass(
withImages(
{
webpack: config => {
// Fixes npm packages that depend on `fs` module
config.node = {
fs: 'empty'
};
/**
* Returns environment variables as an object
*/
const env = Object.keys(process.env).reduce((acc, curr) => {
acc[`process.env.${curr}`] = JSON.stringify(process.env[curr]);
return acc;
}, {});
/** Allows you to create global constants which can be configured
* at compile time, which in our case is our environment variables
*/
config.plugins.push(new webpack.DefinePlugin(env));
return config
},
experimental: {
async rewrites() {
return [
{ source: '/contract/:id', destination: '/contract' },
];
},
},
}
)
)
);