-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathnext.config.js
75 lines (69 loc) · 2.17 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
const envconfig = require('./env.config');
const withPlugins = require('next-compose-plugins');
const withImages = require('next-images');
const path = require('path');
module.exports = withPlugins([withImages], {
webpack(config, options) {
config.resolve.fallback = {
zlib: require.resolve('browserify-zlib'),
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
http: require.resolve('http-browserify'),
https: require.resolve('https-browserify'),
fs: false,
os: false,
tty: false,
};
config.resolve.alias['client'] = path.resolve(__dirname, 'client');
config.resolve.alias['config'] = path.resolve(__dirname, 'config');
// polyfills
const originalEntry = config.entry;
config.entry = async () => {
const entries = await originalEntry();
if (
entries['main.js'] &&
!entries['main.js'].includes('./src/polyfills.js')
) {
entries['main.js'].unshift('./src/polyfills.js');
}
return entries;
};
return config;
},
distDir: '.next',
webpackDevMiddleware: config => {
config.watchOptions = {
poll: 800,
aggregateTimeout: 300,
};
return config;
},
i18n: {
// These are all the locales you want to support in
// your application
locales: ['ko', 'en'],
// This is the default locale you want to be used when visiting
// a non-locale prefixed path e.g. `/hello`
defaultLocale: 'ko',
// This is a list of locale domains and the default locale they
// should handle (these are only required when setting up domain routing)
// Note: subdomains must be included in the domain value to be matched e.g. "fr.example.com".
// domains: [
// {
// domain: 'example.com',
// defaultLocale: 'en-US',
// },
// {
// domain: 'example.nl',
// defaultLocale: 'nl-NL',
// },
// {
// domain: 'example.fr',
// defaultLocale: 'fr',
// // an optional http field can also be used to test
// // locale domains locally with http instead of https
// http: true,
// },
// ],
},
});