forked from furysport/furysport-fury-dapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
89 lines (83 loc) · 2.19 KB
/
webpack.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
const createExpoWebpackConfigAsync = require("@expo/webpack-config");
const Dotenv = require("dotenv-webpack");
const MomentLocalesPlugin = require("moment-locales-webpack-plugin");
// const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const { WebpackDeduplicationPlugin } = require("webpack-deduplication-plugin");
module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);
// needed to use environment variables
config.plugins.push(
new Dotenv(),
new MomentLocalesPlugin(), // removes all locales except en-us
// new BundleAnalyzerPlugin({
// path: "web-report",
// generateStatsFile: true,
// }),
new WebpackDeduplicationPlugin({
cacheDir: "./cache",
})
);
// victory native specific code
config.module.rules.push({
test: /.*victory-native[\\/].*\.js/,
use: {
loader: "babel-loader",
},
});
// needed by gnolang
config.module.rules.push({
test: /.*@cosmjs[\\/]crypto[\\/]build[\\/]pbkdf2\.js/,
use: {
loader: "babel-loader",
options: {
sourceType: "unambiguous",
},
},
});
config.module.rules.push({
test: /.*@cosmjs[\\/]amino[\\/]build[\\/]secp256k1hdwallet\.js/,
use: {
loader: "babel-loader",
options: {
sourceType: "unambiguous",
},
},
});
config.module.rules.push({
test: /.*@cosmjs[\\/]utils[\\/]build[\\/]assert\.js/,
use: {
loader: "babel-loader",
options: {
sourceType: "unambiguous",
},
},
});
config.module.rules.forEach((rule) => {
if (rule.oneOf) {
rule.oneOf.unshift({
test: /\.svg$/,
exclude: /node_modules/,
use: [
{
loader: require.resolve("@svgr/webpack"),
options: {
inlineStyles: {
onlyMatchedOnce: false,
},
viewBox: false,
removeUnknownsAndDefaults: false,
convertColors: false,
},
},
],
});
}
});
// needed by solana libs
config.module.rules.unshift({
type: "javascript/auto",
test: /\.mjs$/,
use: [],
});
return config;
};