-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathwebpack.config.cjs
47 lines (39 loc) · 1.06 KB
/
webpack.config.cjs
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
const copyplugin = require('copy-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
module.exports = {
context: path.join(__dirname, 'src'),
entry: './js/library.js',
experiments: {
asyncWebAssembly: true,
outputModule: true,
topLevelAwait: true,
layers: true // optional, with some bundlers/frameworks it doesn't work without
},
output: {
environment: { module: true },
filename: 'nft-toolkit.js',
library: { type: 'module' }
},
plugins: [
// Work around for Buffer is undefined:
// https://github.com/webpack/changelog-v5/issues/10
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer']
}),
new copyplugin({
patterns: [
{ from: 'static/**/*', to: '[name][ext]' }
]
}),
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1, // disable creating additional chunks
})
],
resolve: {
extensions: ['.js'],
fallback: {
buffer: require.resolve('buffer')
}
}
};