Webpack destroying code in production.

0 votes

I'm building an application using BitcoinJS, and have found that using the -p flag causes webpack to mangle certain parts, breaking the ability to produce transactions.

Example project available here (with install instructions, and how to reproduce): https://github.com/Someguy123/example-webpack-issue

Aug 22, 2018 in Blockchain by digger
• 26,550 points
43 views

1 answer to this question.

0 votes

The problem is that Uglify mangles too much by default in your case. As per bitcoinjs-lib instructions, you need to exclude certain names like this:

plugins: [
    new webpack.optimize.UglifyJsPlugin({
        mangle: {
            except: [
                'Array', 'BigInteger', 'Boolean', 'Buffer',
                'ECPair', 'Function', 'Number', 'Point'
            ]
        }
    })
]

Use webpack instead of webpack -p after configuring the plugin.

It will work.

answered Aug 22, 2018 by slayer
• 29,170 points

Related Questions In Blockchain

+1 vote
1 answer

what is use of msg.sender in solidity code?

msg.sender(address) function indicated the sender of the ...READ MORE

answered Apr 24, 2018 in Blockchain by Shashank
• 10,350 points
509 views
0 votes
1 answer
0 votes
0 answers

how to add path of chain code in hyperledger fabric in startfabric.sh

#!/bin/bash # # Copyright IBM Corp All Rights Reserved # # ...READ MORE

Mar 17 in Blockchain by anonymous
204 views
+1 vote
0 answers
0 votes
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,340 points
92 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
173 views
0 votes
1 answer
0 votes
2 answers

VBA code leads to #value! in cell but works in immediate box

Function GetPrice(strTicker As String, Optional dtDate As ...READ MORE

answered Sep 10, 2018 in Blockchain by Garry
49 views
0 votes
1 answer

Where is the data stored in blockchain?

The smart contract is just the business ...READ MORE

answered Jun 29, 2018 in Blockchain by slayer
• 29,170 points
113 views