From 38e1d0e075d1799291744f5fbdfc7bb0c7807559 Mon Sep 17 00:00:00 2001 From: Milan Steiner Date: Fri, 11 Mar 2022 10:31:54 +0100 Subject: [PATCH] Document webpack configs --- HACKING.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/HACKING.md b/HACKING.md index a8f9696582..1f094684c4 100644 --- a/HACKING.md +++ b/HACKING.md @@ -37,6 +37,37 @@ sha256sum -c checksums.sha256 1. Install dependencies: `yarn install` 2. Install SDKs (to make IDE integration work): `yarn dlx @yarnpkg/sdks` +## Webpack Configs +With WebPack 5, you have to be explicit about the usage of Node.js types and modules that were simply replaced with re-implementations for browsers in Webpack 4. + +Configs for 0.28 and later: +```ts +resolve: { + fallback: { + buffer: false, + crypto: false, + events: false, + path: false, + stream: false, + string_decoder: false, + }, + }, +``` + +Configs for CosmJS < 0.28 +```ts +resolve: { + fallback: { + buffer: false, + crypto: false, + events: false, + path: false, + stream: require.resolve("stream-browserify"), + string_decoder: false, + }, + }, +``` + ## Running tests For unit tests that don't connect to any blockchain, just do: