A major failure in project functionality is observed in the NPM repository due to issues arising from the new version of one of the popular dependencies. The source of the problems was the new release of the mini-css-extract-plugin 2.5.0, designed for extracting CSS into separate files. The package has over 10 million weekly downloads and is used as a direct dependency in more than 7,000 projects.
The new version includes changes that break backward compatibility in importing the library, resulting in errors when attempting to use the previously valid and documented construct 'const MiniCssExtractPlugin = require('mini-css-extract-plugin')', which needed to be replaced with 'const MiniCssExtractPlugin = require('mini-css-extract-plugin').default' when switching to the new version.
The issue manifested in projects that do not explicitly bind the version number when connecting dependencies. As a workaround, it is recommended to lock the dependency to the previous version 2.4.5 by adding '"overrides": {"mini-css-extract-plugin": "2.4.5"}' in Yarn or using the command 'npm i -D --save-exact mini-css-extract-plugin@2.4.5' in NPM.
Among those affected are users of the create-react-app package developed by Facebook, which connects mini-css-extract-plugin as a dependency. Due to the lack of version binding for mini-css-extract-plugin, attempts to run create-react-app resulted in the error 'TypeError: MiniCssExtractPlugin is not a constructor'. The issue also impacted packages such as @wordpress/scripts, @auth0/auth0-spa-js, sql-formatter-gui, LedgerSMB, vip-go-mu-plugins, cybros, vue-cli, chore, etc.
Source: opennet.ru
