mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-10 21:49:15 +00:00
Moving Webpack confs from hacking to readme
This commit is contained in:
parent
b385e53e16
commit
656e023748
63
HACKING.md
63
HACKING.md
@ -37,69 +37,6 @@ sha256sum -c checksums.sha256
|
|||||||
1. Install dependencies: `yarn install`
|
1. Install dependencies: `yarn install`
|
||||||
2. Install SDKs (to make IDE integration work): `yarn dlx @yarnpkg/sdks`
|
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:
|
|
||||||
|
|
||||||
```js
|
|
||||||
module.exports = [
|
|
||||||
{
|
|
||||||
...,
|
|
||||||
resolve: {
|
|
||||||
fallback: {
|
|
||||||
buffer: false,
|
|
||||||
crypto: false,
|
|
||||||
events: false,
|
|
||||||
path: false,
|
|
||||||
stream: false,
|
|
||||||
string_decoder: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
```
|
|
||||||
|
|
||||||
Configs for CosmJS < 0.28
|
|
||||||
|
|
||||||
```js
|
|
||||||
module.exports = [
|
|
||||||
{
|
|
||||||
...,
|
|
||||||
resolve: {
|
|
||||||
fallback: {
|
|
||||||
buffer: false,
|
|
||||||
crypto: false,
|
|
||||||
events: false,
|
|
||||||
path: false,
|
|
||||||
stream: require.resolve("stream-browserify"),
|
|
||||||
string_decoder: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
```
|
|
||||||
|
|
||||||
Also, in both cases you need the Buffer plugin:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
module.exports = [
|
|
||||||
{
|
|
||||||
...,
|
|
||||||
plugins: [
|
|
||||||
...,
|
|
||||||
new webpack.ProvidePlugin({
|
|
||||||
Buffer: ["buffer", "Buffer"],
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
...
|
|
||||||
},
|
|
||||||
];
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running tests
|
## Running tests
|
||||||
|
|
||||||
For unit tests that don't connect to any blockchain, just do:
|
For unit tests that don't connect to any blockchain, just do:
|
||||||
|
64
README.md
64
README.md
@ -96,6 +96,70 @@ We're happy to adjust this list according to users' needs as long as you don't
|
|||||||
ask for Internet Explorer support. If your environment does not support Wasm, we
|
ask for Internet Explorer support. If your environment does not support Wasm, we
|
||||||
can work on a solution with swappable implementations.
|
can work on a solution with swappable implementations.
|
||||||
|
|
||||||
|
|
||||||
|
## 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:
|
||||||
|
|
||||||
|
```js
|
||||||
|
module.exports = [
|
||||||
|
{
|
||||||
|
...,
|
||||||
|
resolve: {
|
||||||
|
fallback: {
|
||||||
|
buffer: false,
|
||||||
|
crypto: false,
|
||||||
|
events: false,
|
||||||
|
path: false,
|
||||||
|
stream: false,
|
||||||
|
string_decoder: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
|
Configs for CosmJS < 0.28
|
||||||
|
|
||||||
|
```js
|
||||||
|
module.exports = [
|
||||||
|
{
|
||||||
|
...,
|
||||||
|
resolve: {
|
||||||
|
fallback: {
|
||||||
|
buffer: false,
|
||||||
|
crypto: false,
|
||||||
|
events: false,
|
||||||
|
path: false,
|
||||||
|
stream: require.resolve("stream-browserify"),
|
||||||
|
string_decoder: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
|
Also, in both cases you need the Buffer plugin:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
module.exports = [
|
||||||
|
{
|
||||||
|
...,
|
||||||
|
plugins: [
|
||||||
|
...,
|
||||||
|
new webpack.ProvidePlugin({
|
||||||
|
Buffer: ["buffer", "Buffer"],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
...
|
||||||
|
},
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|
||||||
We maintain a [development board](https://github.com/orgs/cosmos/projects/6),
|
We maintain a [development board](https://github.com/orgs/cosmos/projects/6),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user