-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
getters and setters in object literals should be valid in es5 target #356
Comments
Somewhat related but not worth making a new issue: Avoid 2 false failures in --- a/scripts/uglify-tests.js
+++ b/scripts/uglify-tests.js
@@ -104,8 +104,8 @@ async function test_case(service, test) {
var { js: output } = await service.transform(input_code, {
// Don't use "minifyWhitespace: true" because esbuild uses some ES6 syntax
// to make things shorter and uglify can't parse ES6.
- minifySyntax: true,
- minifyIdentifiers: true,
+ minify: true,
+ target: "es5",
});
} catch (e) {
const formatError = ({ text, location }) => { Edit: updated patch I can appreciate that the bugs related to the use of
Don't simplify the sequence expression if the parent is |
Even though it's known that esbuild doesn't downlevel all ES2015+ constructs to ES5, with the proposed patch above esbuild can keep ES5 code as ES5 once minified. That presently is not possible. Given a valid ES5 input:
due to an ES5 string literal being promoted to an ES6 template literal.
|
@evanw There's a new --- a/Makefile
+++ b/Makefile
@@ -244,8 +244,12 @@ test262: esbuild | demo/test262
# This runs UglifyJS's test suite through esbuild
+clean-uglify:
+ rm -rf github/uglify
+ rm -rf demo/uglify
+
github/uglify:
mkdir -p github/uglify
cd github/uglify && git init && git remote add origin https://github.com/mishoo/uglifyjs.git
- cd github/uglify && git fetch --depth 1 origin 7a033bb825975a6a729813b2cbe5a722a9047456 && git checkout FETCH_HEAD
+ cd github/uglify && git fetch --depth 1 origin e33c727e8bf7687c827d3e88974ead18af263d12 && git checkout FETCH_HEAD
demo/uglify: | github/uglify I didn't know how to freshen the uglify branch correctly without creating a new
I didn't try updating the terser tests. |
Thanks for calling out all of this stuff by the way :) |
According to ES5.1 section 11.1.5 and
acorn
it's valid ES5...fwiw, it was invalid in ES3:
Possible fix:
with patch:
The text was updated successfully, but these errors were encountered: