fix: size-limit by setting buffer false in webpack

This commit is contained in:
fryorcraken.eth 2022-08-03 15:31:21 +10:00
parent 69b3595d6f
commit bf47803631
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
3 changed files with 54 additions and 37 deletions

52
.size-limit.cjs Normal file
View File

@ -0,0 +1,52 @@
const modifyWebpackConfig = (webpackConfig) => {
if (!webpackConfig.resolve) webpackConfig.resolve = {};
if (!webpackConfig.resolve.fallback) webpackConfig.resolve.fallback = {};
// Can be removed once https://github.com/libp2p/js-libp2p-pubsub/pull/92 is merged and released
webpackConfig.resolve.fallback.buffer = false;
return webpackConfig;
};
module.exports = [
{
name: "Waku core",
path: "dist/bundle.min.js",
import: "{ Waku }",
modifyWebpackConfig,
},
{
name: "Waku default setup",
path: "dist/bundle.min.js",
import: "{ createWaku, waitForRemotePeer }",
modifyWebpackConfig,
},
{
name: "Asymmetric, symmetric encryption and signature",
path: "dist/bundle.min.js",
import: "{ waku_message }",
modifyWebpackConfig,
},
{
name: "DNS discovery",
path: "dist/bundle.min.js",
import: "{ discovery }",
modifyWebpackConfig,
},
{
name: "Privacy preserving protocols",
path: "dist/bundle.min.js",
import: "{ WakuRelay }",
modifyWebpackConfig,
},
{
name: "Light protocols",
path: "dist/bundle.min.js",
import: "{ WakuLightPush, WakuFilter }",
modifyWebpackConfig,
},
{
name: "History retrieval protocols",
path: "dist/bundle.min.js",
import: "{ WakuStore }",
modifyWebpackConfig,
},
];

View File

@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fix
- size-limit config to test several usages of Waku.
- `buffer` is not needed in the browser.
## [0.24.0] - 2022-05-27

View File

@ -57,6 +57,7 @@
"reset-hard": "git clean -dfx && git reset --hard && npm i && npm run build && for d in examples/*/; do (cd $d; npm i); done"
},
"browser": {
"buffer": false,
"crypto": false
},
"engines": {
@ -163,43 +164,6 @@
"**/*.spec.js"
]
},
"size-limit": [
{
"name": "Waku core",
"path": "dist/bundle.min.js",
"import": "{ Waku }"
},
{
"name": "Waku default setup",
"path": "dist/bundle.min.js",
"import": "{ createWaku, waitForRemotePeer }"
},
{
"name": "Asymmetric, symmetric encryption and signature",
"path": "dist/bundle.min.js",
"import": "{ waku_message }"
},
{
"name": "DNS discovery",
"path": "dist/bundle.min.js",
"import": "{ discovery }"
},
{
"name": "Privacy preserving protocols",
"path": "dist/bundle.min.js",
"import": "{ WakuRelay }"
},
{
"name": "Light protocols",
"path": "dist/bundle.min.js",
"import": "{ WakuLightPush, WakuFilter }"
},
{
"name": "History retrieval protocols",
"path": "dist/bundle.min.js",
"import": "{ WakuStore }"
}
],
"lint-staged": {
"*.ts": [
"eslint --fix"