-
Notifications
You must be signed in to change notification settings - Fork 49
/
webpack.test.config.js
52 lines (51 loc) · 1.15 KB
/
webpack.test.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
const webpack = require('webpack')
module.exports = {
entry: `${__dirname}/app/tests/src/index.ts`,
output: {
path: `${__dirname}/app/tests`,
filename: 'dist/index.bundle.js',
},
externals: {
// to avoid including webpack's 'crypto' if window.crypto is available - reduces bundle size
crypto: 'crypto',
},
experiments: {
asyncWebAssembly: true,
topLevelAwait: true,
},
mode: 'development',
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.wasm$/,
type: 'webassembly/async',
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
alias: {
react: 'preact/compat',
},
fallback: {
fs: false,
path: require.resolve('path-browserify'),
stream: require.resolve('stream-browserify'),
},
},
plugins: [
// Auto-import `Buffer`:
// https://github.com/webpack/changelog-v5/issues/10#issuecomment-615877593
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
new webpack.ProvidePlugin({
process: 'process/browser',
}),
],
}