-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathnext.config.js
55 lines (51 loc) · 1.47 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
/** @type {import('next').NextConfig} */
const webpack = require('webpack');
const withPWA = require('next-pwa');
const runtimeCaching = require('next-pwa/cache');
const path = require('path');
module.exports = withPWA({
reactStrictMode: true,
pwa: {
dest: 'public',
disable: process.env.NODE_ENV === 'development',
runtimeCaching,
},
...(process.env.NODE_ENV === 'production' && {
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},
}),
webpack5: true,
webpack: (config, options) => {
config.ignoreWarnings = [/Failed to parse source map/];
const fallback = config.resolve.fallback || {};
Object.assign(fallback, {
stream: require.resolve('stream-browserify'),
fs: require.resolve('browserify-fs'),
});
config.resolve.fallback = fallback;
config.plugins = (config.plugins || []).concat([
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
]);
const experiments = config.experiments || {};
Object.assign(experiments, {
asyncWebAssembly: true,
syncWebAssembly: true,
});
config.experiments = experiments;
const alias = config.resolve.alias || {};
Object.assign(alias, {
react$: require.resolve('react'),
});
config.resolve.alias = alias;
config.resolve.symlinks = true;
config.resolve.modules.push(path.resolve('./node_modules'));
return config;
},
});