-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathnext.config.js
33 lines (29 loc) · 849 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
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
const withWebWorkers = (nextConfig) => {
return {
...nextConfig,
webpack(config, options) {
config.module.rules.unshift({
test: /\.worker\.ts$/i,
use: {
loader: "worker-loader",
options: {
filename: "static/static/[name].[fullhash].js",
publicPath: "/_next/",
esModule: false,
},
},
});
//config.output.globalObject = 'typeof self !== "object" ? self : this';
if (typeof nextConfig.webpack === "function") {
return nextConfig.webpack(config, options);
}
return config;
},
};
};
module.exports = (phase, defaultConfig) => {
return withWebWorkers(withBundleAnalyzer(defaultConfig));
};