react-styleguidist icon indicating copy to clipboard operation
react-styleguidist copied to clipboard

app is undefined in configureServer

Open DryaginMihael opened this issue 8 months ago • 1 comments

Current behavior

I need to register middleware and use this documentation. My project has [email protected] and [email protected]. I added the configureServer function in styleguide.config.js, but I get the following error: TypeError: Cannot read properties of undefined (reading 'get') when starting the project via the styleguidist server.

Thoughts: There was no issue with [email protected] because it used [email protected], which was based on express. However, after [email protected], webpack-dev-server was updated to version 4.x, which no longer works on express but uses http.createServer instead. This is why devServer.app does not exist.

To reproduce

  1. clone fork repository https://github.com/DryaginMihael/styleguidist-example
  2. checkout to branch issue-demo (main changes here)
  3. run npm run start
  4. you got error, server did not start

Expected behavior

  • No error should occur when starting the project.
  • app should be defined.
  • I should be able to register middleware.

DryaginMihael avatar Mar 25 '25 10:03 DryaginMihael