-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcraco.config.js
67 lines (60 loc) · 1.75 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
56
57
58
59
60
61
62
63
64
65
66
67
const webpack = require("webpack");
const path = require("path");
module.exports = {
webpack: {
configure: (config, { env, paths }) => {
config.module.rules = [
{
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto",
},
...config.module.rules.map((rule) => {
if (rule.oneOf instanceof Array) {
rule.oneOf[rule.oneOf.length - 1].exclude = [
/\.(js|mjs|jsx|cjs|ts|tsx)$/,
/\.html$/,
/\.json$/,
];
}
return rule;
}),
];
config.resolve = {
...config.resolve,
fallback: {
...config.resolve.fallback,
process: require.resolve("process/browser"),
assert: require.resolve("assert"),
buffer: require.resolve("buffer"),
stream: require.resolve("stream-browserify"),
crypto: require.resolve("crypto-browserify"),
os: false,
fs: false,
},
alias: {
...config.resolve.alias,
"@solana/wallet-adapter-react": path.resolve(
"./node_modules/@solana/wallet-adapter-react"
),
},
};
const scopePluginIndex = config.resolve.plugins.findIndex(
({ constructor }) =>
constructor && constructor.name === "ModuleScopePlugin"
);
config.resolve.plugins.splice(scopePluginIndex, 1);
config.plugins = [
...config.plugins,
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
}),
new webpack.ProvidePlugin({
process: "process/browser",
}),
];
config.ignoreWarnings = [/Failed to parse source map/];
return config;
},
},
};