This is the error I receive while checking my application.js from public/assets/js in an online JavaScript Minifier:
Parse error: Unexpected token: punc (})
Line 22315, column 33
22314: url: "/products/per_amount",
22315: data: {id: quantity, product},
22316: dataType: "json",
That simply looks like this:
$.ajax({
url: "/products/per_amount",
data: {id: quantity, product},
dataType: "json",
type: "GET",
...
this is the same error as this but everywhere I looked said it was either fixed or the solution I tried did not work.
It seems that you are using a feature of ES6 that is not supported by Uglifier: http://es6-features.org/#PropertyShorthand .
I think Uglifier's target is ES5 and won't accept anything but ES5 code. You can do a rapid fix by rewriting your code in ES5:
$.ajax({
url: "/products/per_amount",
data: {id: quantity, product: product},
dataType: "json",
type: "GET",
If you want to retain your syntax goodies look into using Babel to transpile your code into ES5.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.