From 76b06656c161380d03896a730b9e5c3dfdf8a0fb Mon Sep 17 00:00:00 2001 From: Bianca Wentzel Date: Fri, 30 Aug 2024 13:00:04 +0200 Subject: [PATCH] Updated webpack production configs --- webpack.config.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 72d3afb6..f027b3b9 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -36,7 +36,31 @@ if (["build", "dev"].includes(process.env.npm_lifecycle_event)) { }); } else { // production - config = merge(prodConfig(), baseConfig(), { node: { __dirname: true } }); + config = merge( + prodConfig(), + baseConfig(), + { node: { __dirname: true } }, + { + plugins: [ + new Dotenv(), + // 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", + }), + ] + }, + { + resolve: { + fallback: { + stream: require.resolve("stream-browserify"), + buffer: require.resolve("buffer"), + }, + }, + }); } module.exports = config;