add bundle analyzer

This commit is contained in:
Marin Petrunić 2020-04-09 14:53:44 +02:00
parent 13e8a9fc9e
commit 347429b6b8
No known key found for this signature in database
GPG Key ID: 834D07135E110DA5
3 changed files with 669 additions and 48 deletions

View File

@ -20,6 +20,7 @@
"scripts": { "scripts": {
"prebuild": "rm -rf lib && rm -rf dist", "prebuild": "rm -rf lib && rm -rf dist",
"build": "yarn run build:node && yarn run build:web && yarn run build:types", "build": "yarn run build:node && yarn run build:web && yarn run build:types",
"bundle": "webpack --config webpack.bundle.config.js",
"build:node": "babel --no-babelrc --config-file ./babel.config.json src --copy-files -x .ts -d dist --source-maps", "build:node": "babel --no-babelrc --config-file ./babel.config.json src --copy-files -x .ts -d dist --source-maps",
"build:web": "babel --no-babelrc --config-file ./babel.web.config.json src --copy-files -x .ts -d lib --source-maps", "build:web": "babel --no-babelrc --config-file ./babel.web.config.json src --copy-files -x .ts -d lib --source-maps",
"build:types": "tsc --declaration --outDir dist --emitDeclarationOnly", "build:types": "tsc --declaration --outDir dist --emitDeclarationOnly",
@ -47,6 +48,7 @@
"@types/mocha": "^5.2.7", "@types/mocha": "^5.2.7",
"@typescript-eslint/eslint-plugin": "^2.6.0", "@typescript-eslint/eslint-plugin": "^2.6.0",
"@typescript-eslint/parser": "^2.6.0", "@typescript-eslint/parser": "^2.6.0",
"babel-loader": "^8.1.0",
"chai": "^4.2.0", "chai": "^4.2.0",
"eslint": "^6.6.0", "eslint": "^6.6.0",
"karma": "^4.4.1", "karma": "^4.4.1",
@ -60,12 +62,12 @@
"sinon": "^8.1.0", "sinon": "^8.1.0",
"ts-loader": "^6.2.1", "ts-loader": "^6.2.1",
"typescript": "^3.6.4", "typescript": "^3.6.4",
"webpack": "^4.41.5" "webpack": "^4.41.5",
"webpack-bundle-analyzer": "^3.6.1",
"webpack-cli": "^3.3.11"
}, },
"dependencies": { "dependencies": {
"@types/bn.js": "^4.11.6",
"aead-js": "^0.1.0", "aead-js": "^0.1.0",
"bn.js": "^5.0.0",
"buffer": "^5.4.3", "buffer": "^5.4.3",
"debug": "^4.1.1", "debug": "^4.1.1",
"futoin-hkdf": "^1.3.2", "futoin-hkdf": "^1.3.2",
@ -75,7 +77,7 @@
"it-pair": "^1.0.0", "it-pair": "^1.0.0",
"it-pb-rpc": "^0.1.8", "it-pb-rpc": "^0.1.8",
"it-pipe": "^1.1.0", "it-pipe": "^1.1.0",
"libp2p-crypto": "^0.17.1", "libp2p-crypto": "^0.17.6",
"peer-id": "^0.13.5", "peer-id": "^0.13.5",
"protobufjs": "6.8.8", "protobufjs": "6.8.8",
"tweetnacl": "^1.0.3" "tweetnacl": "^1.0.3"

24
webpack.bundle.config.js Normal file
View File

@ -0,0 +1,24 @@
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
entry: "./src/index.ts",
mode: "production",
output: {
filename: "../bundle/bundle.js"
},
node: {
fs: "empty"
},
resolve: {
extensions: [".ts", ".js"],
},
module: {
rules: [
{test: /\.ts$/, exclude: [/node_modules/], use: {loader: "babel-loader", options: require("./babel.web.config")}}
],
},
plugins: [
new BundleAnalyzerPlugin()
]
};

683
yarn.lock

File diff suppressed because it is too large Load Diff