-
-
Notifications
You must be signed in to change notification settings - Fork 603
/
next.config.js
46 lines (38 loc) · 1.05 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
const webpack = require("webpack");
const config = {
webpack(config, options) {
config.node = {
fs: "empty",
module: "empty",
net: "mock",
tls: "mock"
};
config.plugins.push(
new webpack.DefinePlugin({
"process.env.DEV": JSON.stringify(options.dev),
IN_BROWSER: !options.isServer,
IS_DEV: options.dev
})
);
config.module.rules.unshift({
test: /\.worker\.ts/,
use: {
loader: "worker-loader",
options: {
name: "static/[hash].worker.js",
publicPath: "/_next/"
}
}
});
config.output.globalObject = 'typeof self !== "object" ? self : this';
// Temporary fix for https://github.com/zeit/next.js/issues/8071
config.plugins.forEach(plugin => {
if (plugin.definitions && plugin.definitions["typeof window"]) {
delete plugin.definitions["typeof window"];
}
});
config.output.webassemblyModuleFilename = "static/wasm/[modulehash].wasm";
return config;
}
};
module.exports = config;