Skip to content

Build fails for create-webpack-app generated ES6 projects using 'plugin-syntax-dynamic-import' babel plugin #4419

@riojosdev

Description

@riojosdev

Describe the bug

Cannot build create-webpack-app generated ES6 project.

What is the current behavior?

When building an ES6 project generated using create-webpack-app, the build fails with the following error

ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find package '@babel/plugin-syntax-dynamic-import' imported from C:\006\babel-virtual-resolve-base.js

To Reproduce

Steps to reproduce the behavior:

  • Run npx create-webpack-app path/to/dir
  • Choose ES6 when cli asks Which of the following JS solutions do you want to use?
  • Configure the rest of template configuration with any of the choices
  • Run yarn build

Expected behavior

Running yarn build should build the default generated template without no fails, for smoother onboarding for webpack project setup/test.

Screenshots

Please paste the results of npx webpack-cli info here, and mention other relevant information

Additional context

Similar issue has been reported under the following and have been closed
babel/babel#10212
babel/babel#16899
babel/babel#16901

As per babel docs for syntax-dynamic-import, this plugin need not be used any longer

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