Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"npm run build" results in error in UglifyJS #166

Open
leonardojobim opened this issue Dec 28, 2017 · 2 comments
Open

"npm run build" results in error in UglifyJS #166

leonardojobim opened this issue Dec 28, 2017 · 2 comments

Comments

@leonardojobim
Copy link

Executing the command "npm run build" is resulting in error in UglifyJS.
It isn't able to recognize keys words like "let" and "new" and is showing error messages like below:

ERROR in build.js from UglifyJs Unexpected token: punc (() [build.js:11307,24]
ERROR in build.js from UglifyJs Unexpected token: name (app)

@AlexisSniffer
Copy link

solve it like this

const UglifyJsPlugin = require('uglifyjs-webpack-plugin')


if (process.env.NODE_ENV === 'production') {
  module.exports.devtool = '#source-map'
  // http://vue-loader.vuejs.org/en/workflow/production.html
  module.exports.plugins = (module.exports.plugins || []).concat([
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: '"production"'
      }
    }),
    new UglifyJsPlugin({
      uglifyOptions: {        
        ecma: 8      
      }
    }),
    new webpack.LoaderOptionsPlugin({
      minimize: true
    })
  ])
}

@leonardojobim
Copy link
Author

I recreated the project and it worked fine.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants