Cannot fix “Unexpected token name «i», expected punc «;»” from UglifyJs

前端 未结 3 1943
野趣味
野趣味 2021-01-18 23:56

I have created a react app with a custom next server

server.js:

const { createServer } = require(\'http\');
const next = require(\'n         


        
3条回答
  •  长发绾君心
    2021-01-19 00:47

    According to forums, the problem is caused because UglifyJs does not support ES6 so I tried to solve it with these links: this and this. I almost tried all the suggestion but none of them worked.

    Instead of using UglifyJs, try using terser ! https://github.com/terser/terser

    Uglify-js is able to transpile only es5 syntax. If you want to transpile es6+ syntax use terser instead.

提交回复
热议问题