This repository has been archived by the owner on Jun 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
72 lines (71 loc) · 2.17 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
const CopyWebpackPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
const webpack = require("webpack");
module.exports = {
mode: "development",
entry: path.resolve(__dirname, "./src/index.js"),
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ["babel-loader"],
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.(png|jpe?g|gif)$/i,
use: [
{
loader: "file-loader",
},
],
},
],
},
output: {
filename: "main.js",
path: path.resolve(__dirname, "build"),
},
plugins: [
new HtmlWebpackPlugin({
filename: "index.html",
template: "./src/index.html",
}),
new CopyWebpackPlugin({
patterns: [{ from: "./assets", to: "." }],
}),
new webpack.ProvidePlugin({
process: "process/browser", // Fix undefined "process" in util package
Buffer: ["buffer", "Buffer"], // Fix undefined "Buffer" in util package
}),
],
resolve: {
alias: {
"highlightjs-solidity": "highlightjs-solidity-shimless", // Fork with fixed browser shim
},
extensions: ["*", ".js", ".jsx"],
fallback: {
assert: require.resolve("assert"),
crypto: require.resolve("crypto-browserify"),
fs: false,
http: require.resolve("stream-http"),
https: require.resolve("https-browserify"),
os: require.resolve("os-browserify/browser"),
path: require.resolve("path-browserify"),
readline: false,
stream: require.resolve("stream-browserify"),
url: require.resolve("url"),
worker_threads: false,
},
},
devServer: {
contentBase: "./build",
port: 8080,
historyApiFallback: true,
hot: true,
},
};