Description
Current behavior
Attempting to run the build command fails with webpack 5.88.2 fails with the following error message:
TypeError: Cannot read properties of null (reading 'options')
TypeError: Cannot read properties of null (reading 'options')
at commandBuild (G:\git\react-date-range\node_modules\react-styleguidist\lib\bin\styleguidist.js:115:42)
The exact same issue has been reported and closed here: identical to the issues #1786 && #2143 even though it still is present with the most current version
According to the webpack docs a compiler object is not returned with a callback: https://webpack.js.org/api/node
The issue can temporarily fixed by modifying the files in the bin directory:
Get rid of the callback:
function build(config) {
const webpackWithConfig = (0, _webpack.default)((0, _makeWebpackConfig.default)(config, 'production'));
return webpackWithConfig;
}
and move the callback to the run command:
`
/lib/bin/styleguidist.js>commandBuild
const compiler = build(config);
compiler.run( err => {
if (err) {
console.error(err);
process.exit(1);
} else if (config.printBuildInstructions) {
config.printBuildInstructions(config);
} else {
printBuildInstructions(config);
}
});