Skip to content

UglifyJs Syntax Error fails npm run build but not npm start #984

Closed
@rahatarmanahmed

Description

@rahatarmanahmed

Can you reproduce the problem with latest npm?

Yes.

Description

One of my npm modules causes the production (npm run build) builds to fail with an UglifyJs syntax error. However, I am able to run the app with npm start without any errors or problems.

Expected behavior

Should be able to build production build if development build is working.

Actual behavior

When running npm run build:

Creating an optimized production build...
Failed to compile.

static/js/main.455932b3.js from UglifyJs
SyntaxError: Unexpected token: operator (>) [./~/evolutionary/select1.js:5,0]

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected): [email protected]
  2. node -v: v6.9.0
  3. npm -v: v3.10.9

Then, specify:

  1. Operating system: Mac OS X Sierra
  2. Browser and version: N/A

Reproducible Demo

  1. Generate a new project with create-react-app
  2. Run npm install evolutionary
  3. Put import 'evolutionary' at the top of index.js
  4. Run npm start. Confirm that app loads in browser w/ no errors.
  5. Run npm run build. Error appears

I've never used webpack, but from my experience with browserify I would assume that ES6 syntax in dependencies would be handled just as fine as my app code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions