Skip to content

Commit b8371ad

Browse files
committed
fix(build): polyfill Buffer internally
1 parent c5fc76a commit b8371ad

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

webpack.config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
22
const defaultsDeep = require('lodash.defaultsdeep');
33
const path = require('path');
44
const TerserPlugin = require('terser-webpack-plugin');
5+
const webpack = require('webpack');
56

67
const base = {
78
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
@@ -11,6 +12,11 @@ const base = {
1112
libraryTarget: 'umd',
1213
filename: '[name].js'
1314
},
15+
resolve: {
16+
fallback: {
17+
Buffer: require.resolve('buffer/')
18+
}
19+
},
1420
module: {
1521
rules: [{
1622
test: /\.js$/,
@@ -32,7 +38,11 @@ const base = {
3238
})
3339
]
3440
},
35-
plugins: []
41+
plugins: [
42+
new webpack.ProvidePlugin({
43+
Buffer: ['buffer', 'Buffer']
44+
})
45+
]
3646
};
3747

3848
module.exports = [

0 commit comments

Comments
 (0)