This repository was archived by the owner on Oct 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebpack.config.js
More file actions
59 lines (57 loc) · 1.42 KB
/
webpack.config.js
File metadata and controls
59 lines (57 loc) · 1.42 KB
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
const webpack = require('webpack')
const path = require('path')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const isProd = (process.env.NODE_ENV === 'production')
console.log(`Production mode: ${isProd}`)
module.exports = {
target: 'web',
entry: "./src/index.ts",
output: {
filename: "erdbox.js",
path: path.resolve(__dirname, 'dist')
},
resolve: {
extensions: [".ts", ".tsx", ".js"],
alias: {
"bn.js": require.resolve("bn.js")
},
fallback: {
"buffer": require.resolve('buffer/'),
"crypto": require.resolve('crypto-browserify'),
"stream": require.resolve('stream-browserify'),
"fs": false,
"path": false,
}
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: "ts-loader"
},
{
test: /\.svg$/,
loader: 'react-svg-loader',
},
],
},
plugins: [
new webpack.DefinePlugin({
'process.browser': JSON.stringify(true),
}),
new BundleAnalyzerPlugin({
analyzerMode: 'static',
defaultSizes: 'gzip',
openAnalyzer: false,
reportFilename: path.join(__dirname, 'stats', 'report.html'),
}),
],
mode: isProd ? 'production' : 'development',
devtool: isProd ? undefined : 'inline-source-map',
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 9000
}
}