Nuxt.js: ERROR in server-bundle.js from UglifyJs

Created on 8 Feb 2017  路  3Comments  路  Source: nuxt/nuxt.js

ERROR in server-bundle.js from UglifyJs
SyntaxError: Unexpected token punc 芦)禄, expected punc 芦(禄 [server-bundle.js:194,13]
Webpack build exited with errors
error Command failed with exit code 1.

nuxt.config.js:

build: {
  extend (config, { dev }) {
    if (!dev) {
      config.devtool = false
      config.plugins.push(
        new webpack.optimize.UglifyJsPlugin({
          parse: {
            strict: true
          },
          compress: {
            unsafe: true,
            warnings: false,
            drop_console: true
          },
          output: {
            comments: false,
            ascii_only: true,
            inline_script: true
          },
          mangle: true
        })
      )
    }
  }
}

How to fix it ? :(

This question is available on Nuxt.js community (#c186)
help-wanted question

Most helpful comment

  • Could be a misstyped error in your code, check with some linter first.
  • Is Uglify working at client side code? If so, you can disable the minifier in server side with this:
build: {    
     extend(config, { isDev, isClient }) {
      if (! isDev) {
        if (! isClient) {
         // Plugins that you want to be applied in the server side code.
        }
      }
    },
}
  • Do you write Javascript in ES6/ES7 or ES5?

Could be relationated #250

All 3 comments

  • Could be a misstyped error in your code, check with some linter first.
  • Is Uglify working at client side code? If so, you can disable the minifier in server side with this:
build: {    
     extend(config, { isDev, isClient }) {
      if (! isDev) {
        if (! isClient) {
         // Plugins that you want to be applied in the server side code.
        }
      }
    },
}
  • Do you write Javascript in ES6/ES7 or ES5?

Could be relationated #250

@maicong this is probably due to a external library you are using that fails on the minify or an error in your code.

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

VincentLoy picture VincentLoy  路  3Comments

pehbehbeh picture pehbehbeh  路  3Comments

mikekidder picture mikekidder  路  3Comments

bimohxh picture bimohxh  路  3Comments

gary149 picture gary149  路  3Comments