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
• 27,620 points
25 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,040 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,330 points
220 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
52 views
0 votes
1 answer

How to make sure transactions take no fee in a private Ethereum blockchain?

In a private ethereum network you have ...READ MORE

answered Mar 26, 2018 in Blockchain by Christine
• 15,790 points

edited Mar 26, 2018 by Christine 57 views
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,320 points
43 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
63 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
23 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,040 points
52 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.