-
Notifications
You must be signed in to change notification settings - Fork 6
/
next.config.js
68 lines (62 loc) · 1.63 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
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import nextEnv from 'next-env';
import dotenvLoad from 'dotenv-load';
dotenvLoad();
const withNextEnv = nextEnv();
// const NEXT_PUBLIC_DEEPLINKS_URL = process.env.NEXT_PUBLIC_DEEPLINKS_URL || 'http://localhost:3006';
const DOCKER = !!+process.env.DOCKER;
const DEEPLINKS_URL = DOCKER ? 'http://host.docker.internal:3006' : 'http://localhost:3006';
export default withNextEnv({
distDir: 'app',
webpack5: true,
future: { webpack5: true },
strictMode: false,
async headers() {
return [
{
source: "/api/:path*",
headers: [
{ key: "Access-Control-Allow-Origin", value: "*" },
]
}
]
},
async rewrites() {
return [
{
source: '/api/:gql*',
destination: `${DEEPLINKS_URL}/:gql*`
// destination: `${NEXT_PUBLIC_DEEPLINKS_URL}/:gql*`
},
{
source: '/api/:file*',
destination: `${DEEPLINKS_URL}/:file*`
// destination: `${NEXT_PUBLIC_DEEPLINKS_URL}/:file*`
},
]
},
webpack: (config) => {
// Exclude .tsx files
config.module.rules.push({
test: /\.tsx$/,
use: [],
});
// Only import .js files
// config.resolve.extensions = ['.js', '.jsx'];
config.resolve.fallback = {
"buffer": require.resolve('buffer/'),
"os": false,
"fs": false,
"tls": false,
"net": false,
"path": false,
"zlib": false,
"http": false,
"https": false,
"stream": false,
"crypto": false,
};
return config;
},
});