-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
115 lines (114 loc) · 3.06 KB
/
webpack.config.js
File metadata and controls
115 lines (114 loc) · 3.06 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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
const path = require('path');
const { ProvidePlugin } = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
cache: false,
entry: {
dashboard: './src/dashboard.js',
results: './src/results.js',
background: './src/background.js',
content: './src/content.js',
install: './src/install.js',
gurftron: './src/gurftron.js',
contractWriter: './src/contract-writer.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
clean: true,
libraryTarget: 'umd',
globalObject: 'this',
},
module: {
rules: [
{
test: /\.js$/,
exclude: [
/node_modules/,
path.resolve(__dirname, 'src/ui-helpers.js'), // Exclude ui-helpers.js from processing
],
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', {
targets: 'chrome >= 89',
modules: 'commonjs',
debug: true,
useBuiltIns: 'usage',
corejs: '3.38',
}],
],
plugins: ['@babel/plugin-transform-runtime'],
sourceType: 'module',
cacheDirectory: false,
},
},
},
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
},
],
},
resolve: {
extensions: ['.js', '.json', '.mjs'],
fallback: {
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
buffer: require.resolve('buffer'),
util: require.resolve('util'),
url: require.resolve('url'),
assert: require.resolve('assert'),
process: require.resolve('process/browser'),
path: require.resolve('path-browserify'),
os: require.resolve('os-browserify/browser'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
fs: false,
net: false,
tls: false,
},
alias: {
'process/browser': require.resolve('process/browser.js'),
'@msgpack/msgpack': require.resolve('@msgpack/msgpack'),
},
},
plugins: [
new ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: ['process/browser', 'default'],
}),
new CopyPlugin({
patterns: [
{ from: 'manifest.json', to: 'manifest.json' },
{ from: 'src/*.html', to: '[name][ext]' },
{
from: 'src/*.js',
to: '[name][ext]',
globOptions: {
ignore: [
'**/dashboard.js',
'**/results.js',
'**/install.js',
'**/background.js',
'**/content.js',
'**/gurftron.js',
'**/starknet.js',
'**/contract-writer.js'
],
},
},
{ from: 'src/*.css', to: '[name][ext]' },
{ from: 'src/images/*.png', to: 'images/[name][ext]' },
],
}),
],
mode: 'development',
optimization: {
minimize: true,
},
devtool: false,
target: 'web',
};