forked from Web3Auth/web3auth-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
53 lines (49 loc) · 1.57 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
/* eslint-disable no-param-reassign */
const path = require("path");
const { ProvidePlugin } = require("webpack");
module.exports = {
devServer: {
port: 3000, // CHANGE YOUR PORT HERE!
headers: {
"Access-Control-Allow-Origin": "*",
},
},
configureWebpack: (config) => {
config.resolve.fallback = {
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
assert: require.resolve("assert"),
os: require.resolve("os-browserify/browser"),
https: require.resolve("https-browserify"),
http: require.resolve("stream-http"),
};
config.resolve.alias = {
...config.resolve.alias,
"bn.js": path.resolve(__dirname, "node_modules/bn.js"),
lodash: path.resolve(__dirname, "node_modules/lodash"),
};
config.plugins.push(new ProvidePlugin({ Buffer: ["buffer", "Buffer"] }));
config.plugins.push(new ProvidePlugin({ process: ["process/browser"] }));
},
chainWebpack: (config) => {
if (process.env.NODE_ENV !== "production") {
config.module
.rule("sourcemap")
.test(/\.${js,ts}$/)
.enforce("pre")
.use("source-map-loader")
.loader("source-map-loader")
.end();
}
const svgRule = config.module.rule("svg");
svgRule.uses.clear();
svgRule
.use("vue-loader")
.loader("vue-loader") // or `vue-loader-v16` if you are using a preview support of Vue 3 in Vue CLI
.end()
.use("vue-svg-loader")
.loader("vue-svg-loader");
},
crossorigin: "anonymous",
productionSourceMap: true,
};