From da180fcc92099df0e22a605f19be87dd8a5efa60 Mon Sep 17 00:00:00 2001 From: fyears Date: Tue, 2 Nov 2021 10:07:00 +0800 Subject: [PATCH] overwrite buffer --- webpack.config.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index f848f65..8bdbe24 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,5 @@ const path = require("path"); +const webpack = require("webpack"); const TerserPlugin = require("terser-webpack-plugin"); module.exports = { @@ -9,6 +10,16 @@ module.exports = { path: __dirname, libraryTarget: "commonjs", }, + plugins: [ + // Work around for Buffer is undefined: + // https://github.com/webpack/changelog-v5/issues/10 + new webpack.ProvidePlugin({ + Buffer: ["buffer", "Buffer"], + }), + new webpack.ProvidePlugin({ + process: "process/browser", + }), + ], module: { rules: [ {