Skip to content

Parsing of import() fails in 4.29.0 (Compilation issue, related to dynamic import) #8656

Closed
@Dbuggerx

Description

Bug report

What is the current behavior?

I've updated to v4.29.0, and my code is no longer compiling.

Error:

Module parse failed: Unexpected token (11:10)
You may need an appropriate loader to handle this file type.
|       var AsyncHome = asyncComponent(appendAsyncReducer, epicSubject$, function () {
|         return process.env.SERVER ? require('./home')
>         : import(
|         /* webpackChunkName: "books" */
|         './home');
 @ ./server/ssr.js 15:0-34 167:25-34
 @ ./server/index.js

If I revert to v4.28.2, it works again.

If the current behavior is a bug, please provide the steps to reproduce.

  1. Clone https://github.com/Dbuggerx/react-book-search-sample.git
  2. npm i and compile the code (npm run start-server or npm run start) - it should work
  3. Now, install webpack v4.29.0 and try to compile again

What is the expected behavior?
It should compile the code without errors, as it was doing on v4.28.2

Other relevant information:
webpack version: v4.29.0
Node.js version: v10.15.0
Operating System: Fedora linux 29

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