egret-core icon indicating copy to clipboard operation
egret-core copied to clipboard

UglifyPlugin failed with Unicode identifiers

Open lych77 opened this issue 6 years ago • 1 comments

Engine 5.2.19

Can be triggered by a simple line like this:

let 変数 = 1234;

Under CLI, the error message is like:

egret publish
JS_Parse_Error {
  message: 'Unexpected character \'変\'',
  line: 148,
  col: 34,
  pos: 7881,
  stack: 'Error\n    at new JS_Parse_Error (C:\\Users\\Lych\\AppData\\Roaming\\Egret\\engine\\5.2.19\\tools\\lib\\uglify
-js\\parse.js:189:18)\n    at js_error (C:\\Users\\Lych\\AppData\\Roaming\\Egret\\engine\\5.2.19\\tools\\lib\\uglify-js\
\parse.js:197:11)\n    at parse_error (C:\\Users\\Lych\\AppData\\Roaming\\Egret\\engine\\5.2.19\\tools\\lib\\uglify-js\\
parse.js:299:9)\n    at Object.next_token [as input] (C:\\Users\\Lych\\AppData\\Roaming\\Egret\\engine\\5.2.19\\tools\\l
ib\\uglify-js\\parse.js:544:9)\n    at next (C:\\Users\\Lych\\AppData\\Roaming\\Egret\\engine\\5.2.19\\tools\\lib\\uglif
y-js\\parse.js:643:25)\n    at vardefs (C:\\Users\\Lych\\AppData\\Roaming\\Egret\\engine\\5.2.19\\tools\\lib\\uglify-js\
\parse.js:1063:13)\n    at var_ (C:\\Users\\Lych\\AppData\\Roaming\\Egret\\engine\\5.2.19\\tools\\lib\\uglify-js\\parse.
js:1071:27)\n    at C:\\Users\\Lych\\AppData\\Roaming\\Egret\\engine\\5.2.19\\tools\\lib\\uglify-js\\parse.js:819:30\n
  at C:\\Users\\Lych\\AppData\\Roaming\\Egret\\engine\\5.2.19\\tools\\lib\\uglify-js\\parse.js:704:24\n    at block_ (C:
\\Users\\Lych\\AppData\\Roaming\\Egret\\engine\\5.2.19\\tools\\lib\\uglify-js\\parse.js:978:20)' }

It's actually a fault of the 3rd-party plugin uglify-js, but honestly, Egret Engine keeps using a too stale version of it, specifically, v2.4.16, which was released in 2014. Should we update it a bit to avoid the old problems?

FYI: I've found out the earliest version that has fixed this problem is v2.4.21, released in 2015.

lych77 avatar May 22 '19 06:05 lych77

me too

wildfire810 avatar May 22 '19 07:05 wildfire810