styleguidist / react-styleguidist

Isolated React component development environment with a living style guide
https://react-styleguidist.js.org/
MIT License
10.83k stars 1.44k forks source link

Basic setup with create-react-app does not display markdown documentation #1993

Open ThomasRoest opened 2 years ago

ThomasRoest commented 2 years ago

Current behavior

This very basic setup with create-react-app does not seem to work as expected. The component is found, but the markdown file isn't? In the chrome devtools I do get the following HMR / webpack dev server message:

[HMR] Waiting for update signal from WDS...

To reproduce

The repo with example: https://github.com/ThomasRoest/styleguidist-test

Expected behavior

By default, it should also find and render the markdown examples.

Versions create-react-app 5.0.0 react-styleguidist 11.2.0

elciocf commented 2 years ago

same here

ThomasRoest commented 2 years ago

Displaying the examples can be fixed with the workaround described in https://github.com/styleguidist/react-styleguidist/issues/1910#issuecomment-1013763698

But this still leaves the problem of hot module reloading not working

eya26 commented 2 years ago

I reproduced the example in the repo with the same versions, however, the markdown examples are rendered. styleguidistTest

styleguidistTest2

ThomasRoest commented 2 years ago

@eya26 yes because it includes this workaround https://github.com/ThomasRoest/styleguidist-test/commit/f11e7e05c1ae68cd6ced924fccdcd6b5915e23cd

adubouski commented 2 years ago

Displaying the examples can be fixed with the workaround described in #1910 (comment)

But this still leaves the problem of hot module reloading not working

For all who curious, after a few days of debugging, the following config (added to the workaround mentioned above) fixes hot reloading:

const webpackConfig = {
  devServer: {
      // Not really necessary, but to match the new webpack defaults
      sockPath: '/ws',
      // Web socket client is not injected by CRA webpack config, so ask webpack
      // to include the default one for us
      injectClient: true,
    },
    module: {
      ...
    },
    ...
}