From d09fc0b60e338b64fc005724f5de7d35d712cb85 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 14 Apr 2021 19:05:09 +0200 Subject: [PATCH] Adjust webpack configs for webpack v5 --- packages/amino/webpack.web.config.js | 7 +++++++ packages/cosmwasm-launchpad/webpack.web.config.js | 3 +++ packages/cosmwasm-stargate/webpack.web.config.js | 3 +++ packages/crypto/webpack.web.config.js | 7 +++++++ packages/launchpad/webpack.web.config.js | 7 ++++++- packages/math/webpack.web.config.js | 7 +++++++ packages/proto-signing/webpack.web.config.js | 7 +++++++ packages/socket/webpack.web.config.js | 5 ++++- packages/stargate/webpack.web.config.js | 8 +++++++- packages/tendermint-rpc/webpack.web.config.js | 7 ++++++- packages/utils/webpack.web.config.js | 7 +++++++ 11 files changed, 64 insertions(+), 4 deletions(-) diff --git a/packages/amino/webpack.web.config.js b/packages/amino/webpack.web.config.js index bc77b839..689f2fb4 100644 --- a/packages/amino/webpack.web.config.js +++ b/packages/amino/webpack.web.config.js @@ -1,5 +1,7 @@ +/* eslint-disable @typescript-eslint/naming-convention */ const glob = require("glob"); const path = require("path"); +const webpack = require("webpack"); const target = "web"; const distdir = path.join(__dirname, "dist", "web"); @@ -13,6 +15,11 @@ module.exports = [ path: distdir, filename: "tests.js", }, + plugins: [ + new webpack.ProvidePlugin({ + Buffer: ["buffer", "Buffer"], + }), + ], resolve: { fallback: { crypto: require.resolve("crypto-browserify"), diff --git a/packages/cosmwasm-launchpad/webpack.web.config.js b/packages/cosmwasm-launchpad/webpack.web.config.js index 8ea65695..8e410f96 100644 --- a/packages/cosmwasm-launchpad/webpack.web.config.js +++ b/packages/cosmwasm-launchpad/webpack.web.config.js @@ -22,6 +22,9 @@ module.exports = [ CW3_ENABLED: "", CW1_ENABLED: "", }), + new webpack.ProvidePlugin({ + Buffer: ["buffer", "Buffer"], + }), ], resolve: { fallback: { diff --git a/packages/cosmwasm-stargate/webpack.web.config.js b/packages/cosmwasm-stargate/webpack.web.config.js index cf8eab3c..90b6632a 100644 --- a/packages/cosmwasm-stargate/webpack.web.config.js +++ b/packages/cosmwasm-stargate/webpack.web.config.js @@ -22,6 +22,9 @@ module.exports = [ CW3_ENABLED: "", CW1_ENABLED: "", }), + new webpack.ProvidePlugin({ + Buffer: ["buffer", "Buffer"], + }), ], resolve: { fallback: { diff --git a/packages/crypto/webpack.web.config.js b/packages/crypto/webpack.web.config.js index bc77b839..689f2fb4 100644 --- a/packages/crypto/webpack.web.config.js +++ b/packages/crypto/webpack.web.config.js @@ -1,5 +1,7 @@ +/* eslint-disable @typescript-eslint/naming-convention */ const glob = require("glob"); const path = require("path"); +const webpack = require("webpack"); const target = "web"; const distdir = path.join(__dirname, "dist", "web"); @@ -13,6 +15,11 @@ module.exports = [ path: distdir, filename: "tests.js", }, + plugins: [ + new webpack.ProvidePlugin({ + Buffer: ["buffer", "Buffer"], + }), + ], resolve: { fallback: { crypto: require.resolve("crypto-browserify"), diff --git a/packages/launchpad/webpack.web.config.js b/packages/launchpad/webpack.web.config.js index 385e9568..956cb483 100644 --- a/packages/launchpad/webpack.web.config.js +++ b/packages/launchpad/webpack.web.config.js @@ -15,7 +15,12 @@ module.exports = [ path: distdir, filename: "tests.js", }, - plugins: [new webpack.EnvironmentPlugin({ LAUNCHPAD_ENABLED: "" })], + plugins: [ + new webpack.EnvironmentPlugin({ LAUNCHPAD_ENABLED: "" }), + new webpack.ProvidePlugin({ + Buffer: ["buffer", "Buffer"], + }), + ], resolve: { fallback: { crypto: require.resolve("crypto-browserify"), diff --git a/packages/math/webpack.web.config.js b/packages/math/webpack.web.config.js index 9d5836a8..a6c6b933 100644 --- a/packages/math/webpack.web.config.js +++ b/packages/math/webpack.web.config.js @@ -1,5 +1,7 @@ +/* eslint-disable @typescript-eslint/naming-convention */ const glob = require("glob"); const path = require("path"); +const webpack = require("webpack"); const target = "web"; const distdir = path.join(__dirname, "dist", "web"); @@ -13,5 +15,10 @@ module.exports = [ path: distdir, filename: "tests.js", }, + plugins: [ + new webpack.ProvidePlugin({ + Buffer: ["buffer", "Buffer"], + }), + ], }, ]; diff --git a/packages/proto-signing/webpack.web.config.js b/packages/proto-signing/webpack.web.config.js index bc77b839..689f2fb4 100644 --- a/packages/proto-signing/webpack.web.config.js +++ b/packages/proto-signing/webpack.web.config.js @@ -1,5 +1,7 @@ +/* eslint-disable @typescript-eslint/naming-convention */ const glob = require("glob"); const path = require("path"); +const webpack = require("webpack"); const target = "web"; const distdir = path.join(__dirname, "dist", "web"); @@ -13,6 +15,11 @@ module.exports = [ path: distdir, filename: "tests.js", }, + plugins: [ + new webpack.ProvidePlugin({ + Buffer: ["buffer", "Buffer"], + }), + ], resolve: { fallback: { crypto: require.resolve("crypto-browserify"), diff --git a/packages/socket/webpack.web.config.js b/packages/socket/webpack.web.config.js index a1046a75..f3de017b 100644 --- a/packages/socket/webpack.web.config.js +++ b/packages/socket/webpack.web.config.js @@ -15,7 +15,10 @@ module.exports = [ path: distdir, filename: "tests.js", }, - plugins: [new webpack.EnvironmentPlugin({ SOCKETSERVER_ENABLED: "" })], + plugins: [ + new webpack.EnvironmentPlugin({ SOCKETSERVER_ENABLED: "" }), + new webpack.ProvidePlugin({ process: "process/browser" }), + ], resolve: { fallback: { assert: require.resolve("assert"), diff --git a/packages/stargate/webpack.web.config.js b/packages/stargate/webpack.web.config.js index 056200d2..bf435321 100644 --- a/packages/stargate/webpack.web.config.js +++ b/packages/stargate/webpack.web.config.js @@ -15,7 +15,13 @@ module.exports = [ path: distdir, filename: "tests.js", }, - plugins: [new webpack.EnvironmentPlugin({ SIMAPP_ENABLED: "" })], + plugins: [ + new webpack.EnvironmentPlugin({ SIMAPP_ENABLED: "" }), + new webpack.ProvidePlugin({ + Buffer: ["buffer", "Buffer"], + }), + new webpack.ProvidePlugin({ process: "process/browser" }), + ], resolve: { fallback: { crypto: require.resolve("crypto-browserify"), diff --git a/packages/tendermint-rpc/webpack.web.config.js b/packages/tendermint-rpc/webpack.web.config.js index 3df3f8e1..884253a6 100644 --- a/packages/tendermint-rpc/webpack.web.config.js +++ b/packages/tendermint-rpc/webpack.web.config.js @@ -15,7 +15,12 @@ module.exports = [ path: distdir, filename: "tests.js", }, - plugins: [new webpack.EnvironmentPlugin({ TENDERMINT_ENABLED: "" })], + plugins: [ + new webpack.EnvironmentPlugin({ TENDERMINT_ENABLED: "" }), + new webpack.ProvidePlugin({ + Buffer: ["buffer", "Buffer"], + }), + ], resolve: { fallback: { crypto: require.resolve("crypto-browserify"), diff --git a/packages/utils/webpack.web.config.js b/packages/utils/webpack.web.config.js index 9d5836a8..a6c6b933 100644 --- a/packages/utils/webpack.web.config.js +++ b/packages/utils/webpack.web.config.js @@ -1,5 +1,7 @@ +/* eslint-disable @typescript-eslint/naming-convention */ const glob = require("glob"); const path = require("path"); +const webpack = require("webpack"); const target = "web"; const distdir = path.join(__dirname, "dist", "web"); @@ -13,5 +15,10 @@ module.exports = [ path: distdir, filename: "tests.js", }, + plugins: [ + new webpack.ProvidePlugin({ + Buffer: ["buffer", "Buffer"], + }), + ], }, ];