forked from airswap/airswap-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
craco.config.js
58 lines (56 loc) · 1.64 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
// Allows configuration of create-react-app build process.
// ref: https://github.com/gsoft-inc/craco/blob/master/packages/craco/README.md
const fs = require("fs");
const cracoEnvPlugin = require("craco-plugin-env");
module.exports = {
style: {
postcssOptions: {
plugins: [require("autoprefixer")],
},
},
plugins: [
{
plugin: cracoEnvPlugin,
options: {
variables: {
BUILD_VERSION: fs.existsSync(".git")
? require("child_process")
.execSync("git rev-parse HEAD", { cwd: __dirname })
.toString()
.trim()
: "DEV",
BUILD_DATE: fs.existsSync(".git")
? require("child_process")
.execSync("git show -s --format=%ci", { cwd: __dirname })
.toString()
.trim()
: new Date().toLocaleDateString(),
},
},
},
],
webpack: {
configure: {
externals: ["express"],
ignoreWarnings: [/Failed to parse source map/],
resolve: {
fallback: {
url: require.resolve("browserify-url"),
https: require.resolve("https-browserify"),
http: require.resolve("http-browserify"),
tls: require.resolve("tls-browserify"),
net: require.resolve("net-browserify"),
stream: require.resolve("stream-browserify"),
crypto: require.resolve("crypto-browserify"),
zlib: require.resolve("zlib-browserify"),
path: false,
fs: false,
util: false,
async_hooks: false,
assert: false,
vm: false,
},
},
},
},
};