Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"TypeError: MiniCssExtractPlugin is not a constructor" in fresh wp-scripts installation #38003

Closed
fabiankaegy opened this issue Jan 15, 2022 · 2 comments
Labels
[Package] Scripts /packages/scripts [Type] Bug An existing feature does not function as intended

Comments

@fabiankaegy
Copy link
Member

Description

Starting this morning I am getting a TypeError when trying to scaffold a project with @wordpress/scripts. Based on a similar issue on the CreateReactApp (facebook/create-react-app#11930) Project it appears that the mini-css-extract-plugin was updated to version 2.5.0 and based on our package.json dependency it automatically pulls the latest minor version:

"mini-css-extract-plugin": "^2.1.0",

This is the full error I am getting:

Failed to load '/Users/fabiankaegy/Developer/personal/sandpack-block/node_modules/@wordpress/scripts/config/webpack.config.js' config
[webpack-cli] TypeError: MiniCSSExtractPlugin is not a constructor
    at Object.<anonymous> (/Users/fabiankaegy/Developer/personal/sandpack-block/node_modules/@wordpress/scripts/config/webpack.config.js:240:3)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at WebpackCLI.tryRequireThenImport (/Users/fabiankaegy/Developer/personal/sandpack-block/node_modules/webpack-cli/lib/webpack-cli.js:244:16)
    at loadConfigByPath (/Users/fabiankaegy/Developer/personal/sandpack-block/node_modules/webpack-cli/lib/webpack-cli.js:1710:30)
    at /Users/fabiankaegy/Developer/personal/sandpack-block/node_modules/webpack-cli/lib/webpack-cli.js:1765:11

Step-by-step reproduction instructions

  • Create a new project and install @wordpress/scripts
  • add start: wp-scripts start to the package.json scripts section
  • run npm start
  • See the issue happen

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@fabiankaegy fabiankaegy added [Type] Bug An existing feature does not function as intended [Package] Scripts /packages/scripts labels Jan 15, 2022
@fabiankaegy
Copy link
Member Author

There already is an issue on the mini-css-extract-plugin repo: webpack-contrib/mini-css-extract-plugin#896

@fabiankaegy
Copy link
Member Author

This is a duplicate of #37992

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Scripts /packages/scripts [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

1 participant