-
Notifications
You must be signed in to change notification settings - Fork 18
/
craco.config.js
55 lines (53 loc) · 1.54 KB
/
craco.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
const cracoAlias = require("craco-alias");
const webpack = require("webpack");
module.exports = {
style: {
postcss: {
plugins: [require("tailwindcss"), require("autoprefixer")],
},
},
plugins: [
{
plugin: cracoAlias,
options: {
source: "options",
baseUrl: "./src",
aliases: {
"@": "./"
}
}
}
],
webpack: {
configure: (webpackConfig, { env, paths }) => {
// eslint-disable-next-line no-param-reassign
webpackConfig.resolve.fallback = {
"http": require.resolve("stream-http"),
"https": require.resolve("https-browserify"),
"zlib": require.resolve("browserify-zlib"),
"stream": require.resolve("stream-browserify"),
"events": require.resolve("events/"),
"crypto": require.resolve("crypto-browserify"),
"assert": require.resolve("assert/"),
"buffer": require.resolve("buffer/"),
"util": require.resolve("util/"),
"path": require.resolve("path-browserify"),
"tty": require.resolve("tty-browserify"),
"os": require.resolve("os-browserify/browser"),
"punycode": require.resolve("punycode/"),
"fs": false,
"url": require.resolve("url/"),
"net": require.resolve("net-browserify"),
"child_process": false,
async_hooks: false,
rawBody: false,
};
webpackConfig.plugins.push(
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"]
})
);
return webpackConfig;
}
}
};