-
Notifications
You must be signed in to change notification settings - Fork 1.2k
webpack with minimization (uglify) stopped working with v0.36 #2411
Comments
@mitra42 thanks for reporting, looks like uglifyjs doesn't support the |
That was my first thought - except that I have a bunch of other cases in that repo that use await and webpack just fine, for example in https://github.com/internetarchive/dweb-transports/blob/master/httptools.js. Maybe its a syntax error in how its used in one particular place that uglify catches but other things ignore? Unfortunately I couldn't figure out where as the error message is unhelpfully displayed by its position in the uglified code rathert han in the source code ! |
uglifyjs is deprecated, try this https://github.com/webpack-contrib/terser-webpack-plugin check our webpack config https://github.com/ipfs/aegir/blob/master/src/config/webpack.config.js#L80 |
@mitra42 can you try this and verify? It would be awesome if someone updated our webpack example to use Terser if the default in webpack is going to cause problems 😜. |
@hugomrdias - where do you see uglifyjs as deprecated, uglifyes appears to be, but I cant find anything suggesting uglifyjs is. Though it seems to be badly maintained - and very version dependent for example other repos I just tried broke when I updated uglifyjs-webpack-plugin to 2.x.x @alanshaw js-ipfs doesnt appear to have a default webpack (or is that what is in ipfs/aegir?), but even if it did I believe it would be overridden by the webpack.config in whatever library (like dweb-transports) is doing the |
@mitra42 uglifyjs only supports es5, uglify es is deprecated and terserjs is the current default. Either you run your code through babel and use uglify or you need to use terserjs. FYI webpack defaults to terserjs. refs |
Thanks @hugomrdias - good to know. @mitra42 dweb-transports is configured to use uglify, I think you'll just need to remove that config or switch to Terser. Also, yes, js-ipfs uses the webpack config provided by aegir. |
Understood - Trying to support different transports with different constraints in the same library ended up too had to do. I ended up solving this and the ES6 modules issue #1927 by pulling IPFS out of the library so the consumer can include the IPFS minified version directly in the browser (and skip IPFS for the ES6 modules case) |
Type: Bug
Severity: Medium
Description:
Somewhere between 0.35.0 and 0.36.0 IPFS stopped webpacking in the typical "production" configuration i.e. with Uglify, generating the error:
I missed it until now because the development (non uglify) webpack still works fine.
Steps to reproduce the error:
This may not be the simplest ...
Using
webpack --mode development
works fineThe specific set of
webpack.config.js
I use is in the repo, the problem doesn't seem to be sensitive to that, i.e. I've tried with different webpack configurations form other repos,, and with different babel / webpack versions without any change, all the versions I've tried work fine fordevelopment
or on js-ipfs v0.35.0 but fail inproduction
on 0.36.0 or 0.37.1The text was updated successfully, but these errors were encountered: