From b385e53e1691bb831a3f54151dede36a617d10c5 Mon Sep 17 00:00:00 2001 From: Milan Steiner <69144826+msteiner96@users.noreply.github.com> Date: Mon, 14 Mar 2022 15:12:41 +0100 Subject: [PATCH] Update HACKING.md --- HACKING.md | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/HACKING.md b/HACKING.md index 3448a0ef..c75e2b8c 100644 --- a/HACKING.md +++ b/HACKING.md @@ -38,10 +38,17 @@ sha256sum -c checksums.sha256 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. + +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 + +```js +module.exports = [ + { + ..., resolve: { fallback: { buffer: false, @@ -52,10 +59,16 @@ Configs for 0.28 and later: string_decoder: false, }, }, + }, +]; ``` Configs for CosmJS < 0.28 -```ts + +```js +module.exports = [ + { + ..., resolve: { fallback: { buffer: false, @@ -66,6 +79,25 @@ Configs for CosmJS < 0.28 string_decoder: false, }, }, + }, +]; +``` + +Also, in both cases you need the Buffer plugin: + +```ts +module.exports = [ + { + ..., + plugins: [ + ..., + new webpack.ProvidePlugin({ + Buffer: ["buffer", "Buffer"], + }), + ], + ... + }, +]; ``` ## Running tests