forked from symbol/symbol
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
43 lines (39 loc) · 1.06 KB
/
webpack.config.js
File metadata and controls
43 lines (39 loc) · 1.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
import WasmPackPlugin from '@wasm-tool/wasm-pack-plugin';
import path from 'path';
import URL from 'url';
import webpack from 'webpack';
export default {
entry: './src/index.js',
mode: process.env.NODE_ENV || 'development',
output: {
path: path.resolve(path.dirname(URL.fileURLToPath(import.meta.url)), '_build'),
filename: 'bundle.js',
library: {
type: 'module'
}
},
resolve: {
extensions: ['.js'],
fallback: {
crypto: 'crypto-browserify',
stream: 'stream-browserify'
}
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer']
}),
new WasmPackPlugin({
crateDirectory: path.resolve(path.dirname(URL.fileURLToPath(import.meta.url)), 'wasm'),
extraArgs: '--no-typescript',
outName: 'symbol_crypto_wasm',
outDir: path.resolve(path.dirname(URL.fileURLToPath(import.meta.url)), '_build')
}),
new webpack.NormalModuleReplacementPlugin(/..\/..\/wasm\/pkg\/symbol_crypto_wasm/, '../../_build/symbol_crypto_wasm.js')
],
experiments: {
asyncWebAssembly: true,
outputModule: true
}
};