Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storybook stops working on Create-react-app (CRA) after ejecting #6690

Closed
kluplau opened this issue Apr 30, 2019 · 6 comments
Closed

Storybook stops working on Create-react-app (CRA) after ejecting #6690

kluplau opened this issue Apr 30, 2019 · 6 comments
Labels
bug cra Prioritize create-react-app compatibility has workaround react typescript
Milestone

Comments

@kluplau
Copy link

kluplau commented Apr 30, 2019

Describe the bug
Storybook stops working, after ejecting CRA. Gives Module parse failed: Unexpected token error.

To Reproduce
Steps to reproduce the behavior:

  1. Install CRA npx create-react-app storybook-typescript-eject --typescript and cd storybook-typescript-eject.
  2. Install Storybook npx -p @storybook/cli sb init
  3. Verity it works npm run storybook
  4. Eject npm run eject press y to confirm.
  5. Change Storybook config. Replace loadStories with:
function loadStories() {
  // automatically import all story js files that end with *.stories.tsx
  const req = require.context("../src", true, /\.stories\.tsx$/);
  req.keys().forEach(filename => req(filename));
}
  1. Rename story file to stories/index.stories.tsx
  2. Verify that it doesn't recognize JSX-tag. npm run storybook

Expected behavior
I expected the same config that worked before ejecting would work after.

System:

  • OS: MacOS Mojave and Windows 7
  • Framework: React
  • Version: Latest
@shilman shilman added react bug cra Prioritize create-react-app compatibility typescript labels Apr 30, 2019
@shilman shilman added this to the 5.0.x milestone Apr 30, 2019
@kluplau kluplau changed the title Create-react-app Storybook stops working on Create-react-app (CRA) after ejecting Apr 30, 2019
@kluplau
Copy link
Author

kluplau commented Apr 30, 2019

I think this can be achieved by updating tsconfig.json to match the one provided in this other issue comment.

Just adding "esModuleInterop": true might do the trick. Haven't tested enough.

@stale
Copy link

stale bot commented May 21, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label May 21, 2019
@shilman shilman modified the milestones: 5.0.x, 5.1.x Jun 5, 2019
@stale stale bot removed the inactive label Jun 5, 2019
@stale
Copy link

stale bot commented Jun 26, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jun 26, 2019
@mrmckeb
Copy link
Member

mrmckeb commented Jul 22, 2019

The CRA config doesn't support ejection right now, you'd need to write your own config in that case - as we no longer have a reliable source.

@stale stale bot removed the inactive label Jul 22, 2019
@mrmckeb
Copy link
Member

mrmckeb commented Jul 22, 2019

Let me know if you need a hand with that, in the meantime I'll close this off as it's expected behaviour.

Also, consider forking react-scripts over ejection.

@Dergash
Copy link

Dergash commented Feb 10, 2020

Hello! I've encountered the similiar issue and based on @mrmckeb response about separate configuration drafted a configuration that gave me the same behaviour which I had before ejecting CRA: storybookjs/presets#72 (comment)
Hope it'll help someone who is in the same situation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cra Prioritize create-react-app compatibility has workaround react typescript
Projects
None yet
Development

No branches or pull requests

5 participants