create externals for all dependency
MODIFY
package.json
package.json
"version": "2.0.37",
"description": "Javascript developer library for interacting with Matic Network",
"main": "dist/matic.node.js",
- "types": "lib/index.d.ts",
+ "types": "dist/ts/index.d.ts",
"browser": "dist/matic.umd.js",
"react-native": "dist/matic.node.js",
"files": [
"homepage": "https://github.com/maticnetwork/matic.js#readme",
"dependencies": {
"@maticnetwork/meta": "^2.4.6",
- "@types/bluebird": "^3.5.29",
- "@types/bn.js": "4.11.5",
- "@types/web3": "1.0.19",
"axios": "^0.21.1",
"bn.js": "5.0.0",
"debug": "^4.1.1",
"typescript": "^3.8.3",
"webpack": "^4.43.0",
"webpack-cli": "^4.2.0",
- "yargs": "^16.2.0"
+ "yargs": "^16.2.0",
+ "@types/bn.js": "4.11.5",
+ "@types/web3": "1.0.19"
},
"browserslist": [
"> 1%",

MODIFY
tsconfig.json
tsconfig.json
"lib": ["es2015", "dom"],
"target": "es5",
"rootDir": "src",
- "outDir": "lib",
+ "outDir": "dist/ts",
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",

MODIFY
webpack.config.js
webpack.config.js
@@ -35,6 +35,14 @@ const clientConfig = {
web3: 'web3',
'ethereumjs-util': 'ethereumjs-util',
'query-string': 'query-string',
+ 'bn.js': 'bn.js',
+ axios: 'axios',
+ '@maticnetwork/meta/network': '@maticnetwork/meta/network',
+ 'ethereumjs-tx': 'ethereumjs-tx',
+ 'ethereumjs-util': 'ethereumjs-util',
+ 'merkle-patricia-tree': 'merkle-patricia-tree',
+ 'ethereumjs-block': 'ethereumjs-block',
+ 'eth-sig-util': 'eth-sig-util',
},
resolve: {
modules: [path.resolve(__dirname, 'src'), 'node_modules'],

create externals for all dependency