forked from ciampo/offbeat-appetite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
38 lines (32 loc) · 938 Bytes
/
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
/* eslint-disable @typescript-eslint/no-var-requires */
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
const withPrefresh = require('@prefresh/next');
require('dotenv').config();
const nextConfig = {
webpack(config, options) {
// From preact netx.js example
if (options.isServer) {
config.externals = ['react', 'react-dom', ...config.externals];
}
// From preact netx.js example
config.resolve.alias = {
...config.resolve.alias,
react: 'preact/compat',
react$: 'preact/compat',
'react-dom': 'preact/compat',
'react-dom$': 'preact/compat',
};
config.module.rules.push({
test: /\.(js|ts|tsx)$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
fix: true,
},
});
return config;
},
};
module.exports = withPrefresh(withBundleAnalyzer(nextConfig));