Skip to content

Build succeeding with webpack fails with webpack-dev-server (Unexpected token) #1101

Closed
@about-code

Description

@about-code
  • Operating System: Ubuntu 16.04 LTS
  • Node Version: 8.0.0
  • NPM Version: 5.4.2
  • webpack Version: 3.6.0
  • webpack-dev-server Version: 2.8.0
  • This is a feature request
  • This is a bug

Expected Behavior

webpack-dev-server shouldn't break builds

Actual Behavior

Build succeeding with webpack fails with the same config with webpack-dev-server. Message

ERROR in theme.76a4a23d58ebccf23fb4.js from UglifyJs
Unexpected token: name (urlParts) [theme.76a4a23d58ebccf23fb4.js:1957,4]

How can we reproduce the behavior?

  • clone or download this repo at version 1.0.0-alpha.6
  • npm install dependencies
  • npm list webpack and make sure webpack was installed at 3.6.0
  • npm list webpack-dev-server and make sure webpack-dev-server was installed at 2.8.0 or 2.8.1
  • Have a look at package.json. There are two relevant scripts:
    • npm run build builds production bundles using webpack (succeeds)
    • npm start builds with webpack-dev-server using the same config as build script but fails, unexpectedly

The issue must have been introduced with webpack-dev-server 2.8.0. To validate

  • npm install webpack-dev-server@~2.7.0
  • npm start (succeeds)

Summary of workarounds from the discussion below

  • Downgrade to 2.7.1 (see duhalme)
  • or install UglifyJS-Plugin separately (see shellscape)
  • or temporarily remove UglifyJS-Plugin until webpack includes an es6-capable version
  • or transpile webpack-dev-server (see Turncoat)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions