I have created a react app with a custom next server
server.js:
const { createServer } = require(\'http\');
const next = require(\'n
UglifyJs is ES5 compatible only (does not support ES6). I see in your code your first transpile ES6 to ES5 with Babel. Make sure Babel really transpiles ES5 to ES6 otherwise UglifyJs will throw this error !
I had the same problem and what I did to fix the problem is the following: 1) Transpile ES6 js files with Babel and check the result. 2) As a result I saw that some part of the code was still in ES6! 3) Find the rootcause (my problem was a default babel file name that exclude node_module transpilation => babel 7 don't compile class ES6 which in node_modules).
Hope it helps.