-
-
Notifications
You must be signed in to change notification settings - Fork 179
Conversation
|
uglify
versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please elaborate a bit on the removals? They are related to the breaking API changes between ugilfy-js
&& ugilfy-es
?
src/index.js
Outdated
const RequestShortener = require("webpack/lib/RequestShortener"); | ||
const ModuleFilenameHelpers = require("webpack/lib/ModuleFilenameHelpers"); | ||
const uglify = require("uglify-js"); | ||
const uglifyEs = require("uglify-es"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better dynamically required in L24?
src/index.js
Outdated
|
||
this.uglifyOptions = Object.assign({}, this.options.uglifyOptions || {}, { sourceMap: null }); | ||
|
||
this.uglify = this.options.es6 ? uglifyEs : uglifyJs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.uglify = this.options.es6 ? require('uglify-es') : require('uglify-js');
src/index.js
Outdated
if(typeof options.compressor !== "undefined") options.compress = options.compressor; | ||
this.options = options; | ||
|
||
this.options = Object.assign({}, options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.options = options || {};
There is nothing to assign here (e.g defaults
)
src/index.js
Outdated
const oldWarnFunction = uglify.AST_Node.warn_function; | ||
const warnings = []; | ||
// Copy uglify options | ||
const uglifyOptions = Object.assign({}, this.uglifyOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const options = this.uglifyOptions || {};
src/index.js
Outdated
} | ||
} | ||
if(minifyResult.error) { | ||
throw minifyResult.error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.emitError(minifyResult.error)
? Not 💯 if this.emitError
is Loader API only
Not sure about the semver tbh, guessing it would be |
What's the point of supporting uglify-js. Doesn't uglify-es support a superset of the functionality of uglify-js? |
No need for peerdep either, that was just a hack to support the harmony branch on github |
Yeah... good point, we need to clearify that once and for all 😛 |
Sry it landed in master now 😅 , could you switch again and rebase against current |
package.json
Outdated
@@ -82,4 +81,4 @@ | |||
}, | |||
"homepage": "https://github.com/webpack-contrib/uglifyjs-webpack-plugin", | |||
"license": "MIT" | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invalid text file. Files a sequence lines terminated with a newline character.
@Hartorn can you please rebase to master? |
yep, please rebase against current master, sry for the inconvenience again, this is definitely the next to land 💯 😛 |
@Hartorn Also, i noticed you removed the wrapping |
# Conflicts: # src/index.js
# Conflicts: # package.json
@hulkish @michael-ciniawsky done rebasing. I will have a look at the test now. @hulkish Uglify does not throw error anymore, instead it is given in the result object. |
|
* Putting back try-catch (wrong asset handling) * Adding banner for comments after being sure comments are presents * Correcting filter extraction * Correcting error handling
@Hartorn I recommend making a new pr based on master and just re apply your changes - sorry for the hassle, but I think this is your easiest route tbh. Also, can you please make a new test for these new options that are supported in |
I tried this, because I wanted to be able to use webpack, with uglify es and not js.
Basically, I moved the options for Uglify into uglifyOptions key, and added an option for ES5 or ES6.
I also changed the code, to use the uglify.minify method.
Not sure if I understood something wrong, but I hope this can help.
I can correct this if needed (tested on some of my projects, and it seemed to work)
EDIT :
Here is a quick sum up of the modifications, please ask for precisions if needed.
minify(code, options)
, which go through all the steps of minification (parse, compress, mangle, output)warn_function
Basically, we do not need to use any other function than minify from uglify, it is mainly about giving proper options, handle the source maps and output.
I did not had time to update the docs, will do in the next days.