question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSX not supported in config with CRA

See original GitHub issue

Describe the bug As reported by @rlecaro2 and @Akaryatrh on #5183, JSX is not supported inside of the .storybook folder.

To Reproduce Steps to reproduce the behavior:

  1. Install create-react-app
  2. Install Storybook

Expected behavior JSX will be supported inside the .storybook folder.

System: All.

Additional context We had a similar issue with TypeScript which was resolved. It’s likely that this issue doesn’t occur when working with TypeScript, but this needs more investigation.

It’s been reported that [adding babel-loader to devDependencies fixes the issue[(https://github.com/storybookjs/storybook/issues/5183#issuecomment-505617245), this also needs investigation.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
jamesg1commented, Aug 5, 2019

@jamesg1, would you mind sharing your tsconfig,json if possible? You can cut out anything confidential.

Yeah sure no problem:

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "preserve",
    "baseUrl": "src",
    "rootDirs": [
      "src",
      "stories",
      ".storybook"
    ]
  },
  "include": [
    "src",
    ".storybook"
  ],
  "exclude": [
    "src/**/*.js"
  ]
}
1reaction
shilmancommented, Jul 17, 2019

@mrmckeb I like the first solution also 💯 Thanks for being on top of this! If there’s enough pushback we can also special-case include the /stories folder in addition to the /.storybook folder, but let’s try the more restrictive version first and see if it’s good enough.

Read more comments on GitHub >

github_iconTop Results From Across the Web

customize-cra - Support for the experimental syntax 'jsx' isn't ...
I am using react-app-rewired to configure my CRA project as I was having issues with 2 co-existing versions of React which I'm sure...
Read more >
Adding TypeScript - Create React App
Global installs of create-react-app are no longer supported. To add TypeScript to an existing Create React App project, first install it: npm ...
Read more >
eslint-config-react-app - npm
If you want to use this ESLint configuration in a project not built with Create React App, you can install it with the...
Read more >
4 Reasons Why You Should Prefer Vite Over Create-React ...
Why prefer Vite over create-react-app? 1. Faster spin-up of the development server. Unlike a CRA or bundler-based build setup, Vite does not ......
Read more >
Create-react-app environments - Medium
Update: create-react-app 1.0.0 added built-in support for configuration files ... version of react-scripts, have not used environment configuration yet, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found