-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
77 lines (68 loc) · 1.83 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
76
77
const withFonts = require("next-fonts");
const withBundleAnalyzer = require("@next/bundle-analyzer");
const withTM = require("next-transpile-modules");
const { withSentryConfig } = require("@sentry/nextjs");
// configuration enhancers
const addFonts = (config) => withFonts(config);
const addBundleAnalyzer = (config) =>
withBundleAnalyzer({ enabled: enableAnalyzer })(config);
const addWatchOptions = (baseConfig) => ({
...baseConfig,
webpackDevMiddleware: (config) => ({
...config,
watchOptions: {
poll: 1000,
aggregateTimeout: 300,
},
}),
});
const addTM = (config) =>
withTM(requiredModules, { resolveSymlinks: false })(config);
const buildNextConfig = (baseConfig, ...configEnhancers) =>
configEnhancers.reduce(
(config, configEnhancer) => configEnhancer(config),
baseConfig
);
let addMFConfig = (config) => config;
if (buildWithFederation) {
addMFConfig = addModuleFederationForNavigation;
}
const addRemoteLayoutStub = (nextConfig) => {
return {
...nextConfig,
webpack(config, options) {
if (!federatedByRemote) {
config.plugins.push(new UseRemoteLayoutStubPlugin());
}
if (typeof nextConfig.webpack === "function") {
return nextConfig.webpack(config, options);
}
return config;
},
};
};
const addSentryConfigs = (nextConfig) => withSentryConfig(nextConfig);
module.exports = addSentryConfigs(
buildNextConfig(
{
basePath: siteBasePath,
sentry: {
disableServerWebpackPlugin: true,
disableClientWebpackPlugin: true,
},
productionBrowserSourceMaps: true,
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
},
addFonts,
addBundleAnalyzer,
addWatchOptions,
addMFConfig,
addRemoteLayoutStub,
addTM
)
);