-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathwebpack.config.solweb3.js
55 lines (54 loc) · 1.7 KB
/
webpack.config.solweb3.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
const path = require('path');
const defaultConfig = require('@wordpress/scripts/config/webpack.config');
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
mode: 'production', // Add this line
...defaultConfig,
devtool: false,
entry: {
web3: path.resolve(__dirname, 'src/static/js/sol-web3/index.js'),
},
output: {
...defaultConfig.output,
path: path.resolve(__dirname, 'src/static/js/sol-web3/dist'),
filename: 'index.js'
},
resolve: {
extensions: ['.js'],
...defaultConfig.resolve,
fallback: {
"crypto": require.resolve("crypto-browserify"),
"vm": require.resolve("vm-browserify"),
"stream": require.resolve("stream-browserify"),
}
},
module: {
rules: [
...defaultConfig.module?.rules || [],
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: ['@babel/plugin-transform-runtime']
}
}
}
]
},
optimization: {
minimize: true, // Ensure this is true if not already set by default in production mode
minimizer: [
new TerserPlugin({
terserOptions: {
// You can specify additional options here according to your needs
compress: {
drop_console: true, // Removes console logs for production
},
},
}),
],
},
};