-
Notifications
You must be signed in to change notification settings - Fork 297
/
next.config.js
71 lines (68 loc) · 1.98 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
module.exports = (phase, { defaultConfig }) => {
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
webpack: (config, options) => {
config.module.rules.push(
{
test: /\.svg$/,
issuer: /\.(tsx|ts)$/,
use: [{ loader: '@svgr/webpack', options: { icon: true } }]
},
{
test: /\.gif$/,
// yay for webpack 5
// https://webpack.js.org/guides/asset-management/#loading-images
type: 'asset/resource'
}
)
// for old ocean.js, most likely can be removed later on
config.plugins.push(
new options.webpack.IgnorePlugin({
resourceRegExp: /^electron$/
})
)
const fallback = config.resolve.fallback || {}
Object.assign(fallback, {
// crypto: require.resolve('crypto-browserify'),
// stream: require.resolve('stream-browserify'),
// assert: require.resolve('assert'),
// os: require.resolve('os-browserify'),
// url: require.resolve('url'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
fs: false,
crypto: false,
os: false,
stream: false,
assert: false,
tls: false,
net: false
})
config.resolve.fallback = fallback
config.plugins = (config.plugins || []).concat([
new options.webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer']
})
])
return typeof defaultConfig.webpack === 'function'
? defaultConfig.webpack(config, options)
: config
},
async redirects() {
return [
{
source: '/publish',
destination: '/publish/1',
permanent: true
}
]
}
// Prefer loading of ES Modules over CommonJS
// https://nextjs.org/blog/next-11-1#es-modules-support
// experimental: { esmExternals: true }
}
return nextConfig
}