-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathnext.config.js
More file actions
35 lines (29 loc) · 812 Bytes
/
next.config.js
File metadata and controls
35 lines (29 loc) · 812 Bytes
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
const withPreact = (config, { dev, isServer }) => {
if (!dev && !isServer) {
Object.assign(config.resolve.alias, {
react: 'preact/compat',
'react-dom/test-utils': 'preact/test-utils',
'react-dom': 'preact/compat',
});
}
return config;
};
const enhanceWebpackConfig = (config) => {
config.module.rules.push({
test: /\.md$/,
loader: 'frontmatter-markdown-loader',
});
return config;
};
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
module.exports = withBundleAnalyzer({
future: { webpack5: true },
target: 'serverless',
webpack: (config, options) => {
let enhancedConfig = withPreact(config, options);
enhancedConfig = enhanceWebpackConfig(config);
return enhancedConfig;
},
});