Skip to content

Uncaught SyntaxError: Unexpected token import #4857

@klimashkin

Description

@klimashkin

Bug

What is the current behavior?
In case of development environment such code

if (process.env.NODE_ENV === 'testing') {
  import('somemodule');
}

is transformed by webpack 2.5.1 into this

if (false) {
  import('somemodule');
}

which leads to Uncaught SyntaxError: Unexpected token import error in the latest Chrome.

Node.JS 7.10.0, babel 6.24.1 has syntax-dynamic-import plugin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions