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,740 points
397 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,350 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 25, 2018 in Blockchain by Shashank
• 10,400 points
8,515 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, 2019 in Blockchain by anonymous
1,088 views
+1 vote
0 answers
+1 vote
1 answer

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

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,450 points
1,144 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
1,692 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,233 views
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
824 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,350 points
1,234 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP