-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathvue.config.js
100 lines (94 loc) · 2.94 KB
/
vue.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
90
91
92
93
94
95
96
97
98
99
100
/* eslint-disable */
var PrerenderSpaPlugin = require("prerender-spa-plugin")
var path = require("path")
const TerserPlugin = require("terser-webpack-plugin")
const CopyPlugin = require("copy-webpack-plugin")
const webpack = require("webpack")
module.exports = {
pages: {
index: {
title: "Index Page",
entry: "src/index.ts",
template: "public/index.html",
filename: "index.html"
}
},
runtimeCompiler: true,
devServer: {
server: "http",
allowedHosts: "all"
},
configureWebpack: config => {
console.log("nodeenv:", process.env.NODE_ENV)
// https://github.com/sindresorhus/got/issues/345
let plugins = [
new webpack.IgnorePlugin({ resourceRegExp: /^electron$/ }),
new webpack.EnvironmentPlugin(['NODE_ENV', 'INFURA_PROJECT_ID', 'EXT_VALIDATORS_URL', 'WALLETCONNECT_PROJECT_ID']),
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"] // set the global Buffer to the Buffer export from the buffer package
})
]
config.optimization = {
minimizer: [
new TerserPlugin({
terserOptions: {
sourceMap: true,
ecma: undefined,
warnings: false,
compress: {},
mangle: false, // Note `mangle.properties` is `false` by default.
module: false,
keep_classnames: undefined,
keep_fnames: true,
}
})
]
}
if (process.env.NODE_ENV === "test") {
config.externals = {
scrypt: "require('scrypt')"
}
config.target = "node"
}
plugins.push(
new CopyPlugin({
patterns: [{
from: "src/assets/tokens/",
to: "tokens"
}]
})
)
return {
devtool: 'source-map',
resolve: {
alias: {
"bn.js": path.resolve(__dirname, "node_modules/bn.js/lib/bn.js"),
"web3-core": path.resolve(__dirname, "node_modules/web3-core"),
"web3-core-method": path.resolve(__dirname, "node_modules/web3-core-method"),
"web3-core-helpers": path.resolve(__dirname, "node_modules/web3-core-helpers"),
"web3-eth-accounts": path.resolve(__dirname, "node_modules/web3-eth-accounts"),
"web3-eth-contract": path.resolve(__dirname, "node_modules/web3-eth-contract"),
"web3-utils": path.resolve(__dirname, "node_modules/web3-utils"),
},
fallback: {
buffer: require.resolve("buffer/"),
stream: require.resolve("stream-browserify"),
http: require.resolve("stream-http"),
https: require.resolve("https-browserify"),
net: false,
child_process: false,
fs: false,
}
},
externals: {
"shelljs": "shelljs"
},
plugins: plugins
}
},
chainWebpack: config => {
config.module.rules.delete("eslint")
config.resolve.set("symlinks", false) // makes yarn link loom-js work
config.module.rules.delete("uglify")
}
}