Nuxt.js: Safari 10, Uglify: SyntaxError: Cannot declare a let variable twice: 'e'

Created on 1 Apr 2018  路  3Comments  路  Source: nuxt/nuxt.js

Note, I would have used the CMTY app, but authorization grants you FULL access to my personal information, including private email addresses, private profile info, followers, and organization access! Just to file a bug report!?

It appears that there is a bug in Safari 10, that will result in a Loading chunk 0 failed. error. It appears to be due to a preceding error SyntaxError: Cannot declare a let variable twice: 'e' caused by the Safari 10 ES6 loop bug

There is a related Uglify (UglifyJS2/issues/1753) thread that provides a work-around:

CLI:

--mangle safari10=true

or from minify() with the option:

{
  mangle: {
    safari10: true
  }
}

So in the context of Nuxt, the config can be tweaked to:

// nuxt.config.js
module.exports = {
  build: {
    uglify: {
      uglifyOptions: {
        mangle: { safari10: true }
      }
    }
  }
}

But my suggestion is that Nuxt add this as a default Uglify option, as Safari 10 is still a relatively common browser for those who haven't yet upgraded to High Sierra.

// https://github.com/nuxt/nuxt.js/blob/master/lib/builder/webpack/client.config.js
// line 187
        new UglifyJSPlugin(
          Object.assign(
            {
              // cache: true,
              sourceMap: true,
              parallel: true,
              extractComments: {
                filename: 'LICENSES'
              },
              uglifyOptions: {
                mangle: {
                  safari10: true
                },
                output: {
                  comments: /^\**!|@preserve|@license|@cc_on/
                }
              }
            },
            this.options.build.uglify
          )
        )

This question is available on Nuxt.js community (#c6815)

Most helpful comment

@bjunc @husayt it's updated, see https://meta.cmty.io/cmty/cmty/issues/c13, see the steps inside.

Then you can file a Bug report for this issue, this will help us a lot for our issue triage on Nuxt :+1:

All 3 comments

@Atinux @alexchopin , @bjunc has a point: I and many others haven't registered for CMTY for the same reason. It is asking for too much access. It is asking FULL access to my personal details and gives no option to exclude private organisations: (see in the pic)
image

I am sure this is not what you intended for, but that it is preventing most real users from joining otherwise a very useful platform

@bjunc @husayt it's updated, see https://meta.cmty.io/cmty/cmty/issues/c13, see the steps inside.

Then you can file a Bug report for this issue, this will help us a lot for our issue triage on Nuxt :+1:

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pehbehbeh picture pehbehbeh  路  3Comments

surmon-china picture surmon-china  路  3Comments

bimohxh picture bimohxh  路  3Comments

vadimsg picture vadimsg  路  3Comments

VincentLoy picture VincentLoy  路  3Comments