-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
36 lines (33 loc) · 1.02 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
const webpack = require("webpack");
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config, { isServer, config: oldConfig }) => {
config.optimization = {
minimize: false,
};
config.resolve.alias.canvas = false;
config.resolve.alias.encoding = false;
config.resolve.fallback = { "react-native-fs": false, critters: false };
// config.externals = {
// "react-native-fs": "reactNativeFs",
// critters: "critters",
// };
if (!isServer) {
config.resolve.fallback = {
...config.resolve.fallback,
stream: require.resolve("stream-browserify"),
crypto: require.resolve("crypto-browserify"),
};
config.plugins.push(
new webpack.ProvidePlugin({
process: "process/browser",
}),
new webpack.NormalModuleReplacementPlugin(/node:crypto/, (resource) => {
resource.request = resource.request.replace(/^node:/, "");
})
);
}
return config;
},
};
module.exports = nextConfig;