forked from fabianbormann/meerkat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
77 lines (75 loc) · 1.9 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
73
74
75
76
77
const webpack = require('webpack');
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const config = {
mode: 'production',
entry: path.resolve(__dirname, 'meerkat.ts'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'meerkat.min.js',
library: { name: 'Meerkat', type: 'var', export: 'default' },
libraryTarget: 'umd',
},
experiments: {
asyncWebAssembly: true,
syncWebAssembly: true,
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
['@babel/preset-typescript', { allowNamespaces: true }],
],
},
},
},
],
},
resolve: {
extensions: ['*', '.js', '.jsx', '.ts', '.tsx', '.scss'],
fallback: {
assert: false,
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
buffer: require.resolve('buffer/'),
path: require.resolve('path-browserify'),
https: require.resolve('https-browserify'),
http: require.resolve('stream-http'),
url: false,
'process/browser': require.resolve('process/browser'),
util: require.resolve('util/'),
net: false,
fs: false,
querystring: false,
dns: false,
async_hooks: false,
dgram: false,
zlib: false,
},
},
plugins: [
new webpack.ProgressPlugin(),
/*new CleanWebpackPlugin({
verbose: true,
cleanStaleWebpackAssets: true,
}),*/
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser',
}),
new webpack.DefinePlugin({
global: 'globalThis',
}),
],
infrastructureLogging: {
level: 'info',
},
};
module.exports = config;