Skip to content
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

UglifyJS breaks in production builds #474

Closed
pdooner opened this issue Jan 9, 2019 · 10 comments
Closed

UglifyJS breaks in production builds #474

pdooner opened this issue Jan 9, 2019 · 10 comments

Comments

@pdooner
Copy link

pdooner commented Jan 9, 2019

A bump to 1.0.0 resulted in exceptions from UglifyJS during webpack's bundling process.
error message was ...
ERROR in client.js from UglifyJS
Unexpected token: keyword (const)

using webpack 4.0
isolated issue to bumping the react-sortable-hoc package to 1.0.0

@clauderic
Copy link
Owner

Could you try using [email protected]? Should hopefully be fixed.

@pdooner
Copy link
Author

pdooner commented Jan 9, 2019

Yes, I am still seeing it in 1.3.1
In troubleshooting the cause, I narrowed it down to the update to 1.0.0, but it has been happening in the versions since then as well.
(thanks for the quick response)

@shepmaster
Copy link

There's no git tag for 1.3.1, but I don't see any changes to master that involve babel-plugin-transform-async-to-promise, as the CHANGELOG states. It's only a version bump and the CHANGELOG text. Perhaps a commit got lost somewhere?

@shepmaster
Copy link

I do see changes if I diff the raw packages though:

diff -r --unified=0 1.3.0/package/dist/index.js 1.3.1/package/dist/index.js
--- 1.3.0/package/dist/index.js	1985-10-26 04:15:00.000000000 -0400
+++ 1.3.1/package/dist/index.js	1985-10-26 04:15:00.000000000 -0400
@@ -9 +9 @@
-const _Pact = (function() {
+var _Pact = (function() {
@@ -12,2 +12,2 @@
-		const result = new _Pact();
-		const state = this.s;
+		var result = new _Pact();
+		var state = this.s;
@@ -15 +15 @@
-			const callback = state & 1 ? onFulfilled : onRejected;
+			var callback = state & 1 ? onFulfilled : onRejected;
@@ -29 +29 @@
-				const value = _this.v;
+				var value = _this.v;
@@ -66 +66 @@
-		const observer = pact.o;
+		var observer = pact.o;
@@ -87 +87 @@
-const _earlyReturn = {};
+var _earlyReturn = {};
@@ -90 +90 @@
-const _AsyncGenerator = (function() {
+var _AsyncGenerator = (function() {
@@ -117 +117 @@
-		const _this = this;
+		var _this = this;
@@ -119 +119 @@
-			const _pact = _this._pact;
+			var _pact = _this._pact;
@@ -121 +121 @@
-				const _entry = _this._entry;
+				var _entry = _this._entry;
@@ -139 +139 @@
-						const pact = new _Pact();
+						var pact = new _Pact();
@@ -156 +156 @@
-		const _this = this;
+		var _this = this;
@@ -158 +158 @@
-			const _pact = _this._pact;
+			var _pact = _this._pact;
@@ -178 +178 @@
-		const _this = this;
+		var _this = this;
@@ -180 +180 @@
-			const _pact = _this._pact;
+			var _pact = _this._pact;
diff -r --unified=0 1.3.0/package/dist/index.umd.js 1.3.1/package/dist/index.umd.js
--- 1.3.0/package/dist/index.umd.js	1985-10-26 04:15:00.000000000 -0400
+++ 1.3.1/package/dist/index.umd.js	1985-10-26 04:15:00.000000000 -0400
@@ -10 +10 @@
-	const _Pact = (function() {
+	var _Pact = (function() {
@@ -13,2 +13,2 @@
-			const result = new _Pact();
-			const state = this.s;
+			var result = new _Pact();
+			var state = this.s;
@@ -16 +16 @@
-				const callback = state & 1 ? onFulfilled : onRejected;
+				var callback = state & 1 ? onFulfilled : onRejected;
@@ -30 +30 @@
-					const value = _this.v;
+					var value = _this.v;
@@ -67 +67 @@
-			const observer = pact.o;
+			var observer = pact.o;
@@ -88 +88 @@
-	const _earlyReturn = {};
+	var _earlyReturn = {};
@@ -91 +91 @@
-	const _AsyncGenerator = (function() {
+	var _AsyncGenerator = (function() {
@@ -118 +118 @@
-			const _this = this;
+			var _this = this;
@@ -120 +120 @@
-				const _pact = _this._pact;
+				var _pact = _this._pact;
@@ -122 +122 @@
-					const _entry = _this._entry;
+					var _entry = _this._entry;
@@ -140 +140 @@
-							const pact = new _Pact();
+							var pact = new _Pact();
@@ -157 +157 @@
-			const _this = this;
+			var _this = this;
@@ -159 +159 @@
-				const _pact = _this._pact;
+				var _pact = _this._pact;
@@ -179 +179 @@
-			const _this = this;
+			var _this = this;
@@ -181 +181 @@
-				const _pact = _this._pact;
+				var _pact = _this._pact;

@clauderic
Copy link
Owner

Could you try using a build created from this branch #477? Recently switched to microbundle, which uses Buble to compile the bundles, and I suspect that might be the issue.

This PR reverts back to using Babel and rollup

@clauderic clauderic reopened this Jan 9, 2019
@pdooner
Copy link
Author

pdooner commented Jan 9, 2019

Yeah, I ran a build from that branch (477) and it resolved the issue in my bundling step.
Merci!

@clauderic
Copy link
Owner

Alright, glad to hear. Will release a new version soon and post back here. Sorry for the headaches this may have caused you 😅

@pdooner
Copy link
Author

pdooner commented Jan 10, 2019

np - I can manage with the pre 1.0.0 until you get that package updated.
Thanks for the responsiveness on this one.

@clauderic
Copy link
Owner

@pdooner Just published 1.4.0, which should hopefully resolve all the issues you were facing. If not, let me know and we can re-open this issue.

note: The CommonJS and ES Module builds now use @babel/babel-transform-runtime, so @babel/runtime has been added as a dependency.

@pdooner
Copy link
Author

pdooner commented Jan 10, 2019

@clauderic - I've bumped to 1.4.0, and the issue is resolved with that version.
Thanks again for the responsiveness (and for the note - appreciate it)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants