Skip to content

webpack -p outputs: ERROR in bundle.js from UglifyJs Unexpected token: name (login) [./login.es6:2,4] #3

@MBing

Description

@MBing

I am getting an error when trying to use webpack -p. When I change the code to ES5 compatible code it seems to work. Something with the UglifyJS minification and ES6 apparently.

This is my login.es6 file:

"use strict";
let login = (username, pw) => {
    if (username !== 'admin' || pw !== 'radical') {
        console.log("login incorrect");
    }
};

login("admin", "test");

I have exactly the same code as the course mentions. I am using the newer versions of the tools and it seems to be a problem there. When using the versions as provided in the course, There is also no error when only changing babel-core and babel-loader to the versions provided.

My version of devDependencies (with UglifyJS error):

"devDependencies": {
  "babel-core": "^6.1.4",
  "babel-loader": "^6.1.0",
  "jshint": "^2.8.0",
  "jshint-loader": "^0.8.3",
  "node-libs-browser": "^0.5.3",
  "strip-loader": "^0.1.0",
  "webpack": "^1.12.4"
}

My partially updated version of devDependencies (without UglifyJS error):

"devDependencies": {
  "babel-core": "^5.4.7",
  "babel-loader": "^5.1.3",
  "jshint": "^2.8.0",
  "jshint-loader": "^0.8.3",
  "node-libs-browser": "^0.5.3",
  "strip-loader": "^0.1.0",
  "webpack": "^1.12.4"
}

Does anyone have an idea on how to solve this minification problem while using babel >6?
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions