Many users have reported that their favorite Facebook (opens in new tab) apps are no longer working following a recent change to a popular open source software (opens in new tab) project.
The open source project responsible is developed by Facebook's parent company Meta (opens in new tab) and is called Create React App. Distributed on both GitHub and npm, Create React App is designed to help developers quickly build single-page React applications with just a few simple commands. As a result, loads of developers rely on it to build apps for Facebook and other sites.
GitHub users recently began reporting problems (opens in new tab) when trying to build their create-react-app builds after receiving the following error message: “Type:Error: MiniCssExtractPlugin is not a constructor”. This error message shows that the problem doesn't lie with Create React App itself but rather with one of its dependencies called Mini CSS Extract Plugin.
Mini CSS Extract Plugin is another popular project that over 4.6m GitHub repos and more than 7,000 npm projects rely on. This project is used to extract CSS code into separate files, generating a CSS file per each JavaScript file that contains CSS according to BleepingComputer (opens in new tab).
Potential workarounds
The latest version of the Mini CSS Extract Plugin (v. 2.5.0) was published quite recently and it appears that this update is what is leading to Create React App project builds to fail.
While BleepingComputer believes that the addition of “types” to the plugin could be what is leading to Create React App instances to break, a bug report (opens in new tab) on GitHub (opens in new tab) takes a further look at some possible causes.
Until Facebook's open source team releases a proper fix for the issue, some developers have been able to get their Create React App builds to work by downgrading Mini CSS Extract Plugin to version 2.4.5. According to developer Alexandru Pavalovi (opens in new tab), you can pin your version to 2.4.5 by adding several lines of code to your JavaScript app's package.json file. The code that needs to be added is:
"resolutions": {
"mini-css-extract-plugin": "2.4.5"
},
However, this workaround doesn't work for those not using Yarn but front-end developer Oscar Busk (opens in new tab) says that running the following command (npm i -D --save-exact mini-css-extract-plugin@2.4.5) may work.
Hopefully the problem will be resolved soon with a more permanent fix but until then, you can try testing out these two workarounds to get your Create React App builds to work.
We've also featured the best laptops for programming (opens in new tab) and best JavaScript courses (opens in new tab)
Via BleepingComputer (opens in new tab)