-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with webpack (UglifyJS) and version bitcoinjs-lib@3.1.1 #959
Comments
bitcoinjs-lib start used https://github.com/bitcoinjs/bech32/ from 3.2.0 |
Sorry, what do you mean by building bech32. Whats the process for that? |
With trying building bech32 we will able determine is this issue related with bech32 or not. |
But I don't know how to build bech32 standalone. I just use npm for everything. |
npm -D install uglify-es-webpack-plugin webpack.config.js const UglifyEsPlugin = require('uglify-es-webpack-plugin');
module.exports = {
// ・・・
plugins: [
new UglifyEsPlugin(),
],
// ・・・
} |
@fanatid is |
@junderw using I think the error comes from this line: Line 78 in fe0ad81
I just updated the repository. The code of bitcoinjs-lib is very simple: https://github.com/Josema/bitcoinjs-lib_error/blob/master/src/index.js This code works when |
Our workaround was just not uglifying some parts of the code: https://github.com/blocktrail/blocktrail-sdk-nodejs/blob/1c39759def25bc52910583e3dda40db3e10a1fd4/Gruntfile.js#L161 |
Wow, that fixed the issue! For webpack users just add the options inside of plugins
Thank you @afk11. Thank you all too. |
Is there any way to get this to work with angular-cli projects? It seems that you cannot overwrite the uglify config, so the fix by @Josema doesn't work. |
In previous versions of angluar-cli, we can do My solution for angular-cli is to use angular builder. After switching to the angular builder, you can config your own webpack settings and uglify-js settings. Remind to put {
"projects": {
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "./extra-webpack.config.js",
"replaceDuplicatePlugins": true,
"mergeStrategies": {
"optimization": "replace"
}
}
}}}}
} at your Also in This problem takes me more than one day to figure out. Hope this would help. |
Those who are coming here from google, running into issues with bitcoinjs-lib and webpack 5. Try downgrading to webpack 4. Worked for me. Some of the errors look like: |
@Josema How can I apply it in react native project? |
Hi sir. |
I have a project using a Webpack boilerplate (https://github.com/Josema/preact-webpack-hmr) that has two environments.
dev
andprod
. On dev, I don't have any issue because Webpack does not Uglify the code. But in prod I have this problem:I know the error comes from
bitcoinjs-lib
because happen when I use theTransactionBuilder.sign()
method.Then, if I upgrade to 3.2.1 or above the problem of the code disappear. And I got this error when running Webpack/Uglify.
Output when using
@3.1.1
:All good. Output when using
@3.2.1
or above:Notice that the size of libs.js change from 578 kB to 1.32 MB. I don't know how to fix this so any help would be really really appreciated.
I have created a repository with the minimal configuration to reproduce the same errors:
https://github.com/Josema/bitcoinjs-lib_error
The text was updated successfully, but these errors were encountered: