GithubHelp home page GithubHelp logo

Comments (4)

shilman avatar shilman commented on July 17, 2024

Congrats on finding a juicy bug, and bigger congrats on figuring out the "right" solution! 🎉

I debugged the problem using Storybook's --debug-webpack-config option, and it's kind of subtle. Here's what's happening:

  1. preset-typescript is doing what it's supposed to
  2. @storybook/react's cra-config is executing (automatically) downstream and removing the .tsx rule added by preset-typescript

The reason your manual config works is because it is executed downstream from that.

Here's what I think needs to happen:

  1. preset-typescript docs need to instruct you to use a custom config in the case of CRA (use a custom config)
  2. cra-config needs to be moved out into its own preset so that it's easier to reason about, rather than being black magic storybookjs/storybook#7221
  3. The preset loading infrastructure needs a way of logging when there are conflicting rules storybookjs/storybook#7220
  4. preset-cra probably needs to use the same logging method to let users know when it's removing conflicting rules.

In the meantime, what you did (custom config) is actually the right thing to do IMHO.

What do you think?

from presets.

city41 avatar city41 commented on July 17, 2024

Interesting. CRA is pretty magical so I'm not surprised it's a factor here. The reason I created a CRA app is to just create a small demo of the same behavior I'm seeing in my real app at work. That app doesn't use CRA, so I'll have to figure out what is causing it to go astray. I didn't know about --debug-webpack-config, that should be handy.

This isn't blocking me. I'm happy to just configure webpack manually. But it looks like these presets are new? So I figured I'd report this in case you all weren't aware.

Thanks for the quick response!

EDIT: and to address some of your questions. Logging conflicting rules would be super helpful. For preset-cra, are you proposing the CRA team extract out their webpack config for situations like this? Worth talking to them about it, but on the surface seems to go against CRA's "singular" approach?

No wait, cra-config looks to be a separate package storybook is taking advantage of. Then yeah, based on that your idea sounds pretty solid to me.

from presets.

shilman avatar shilman commented on July 17, 2024

Yeah really appreciate the issue and the repro. Even if you're not using CRA yourself, it's probably the most common use case among all our users!

from presets.

EdenTurgeman avatar EdenTurgeman commented on July 17, 2024

It seems to also happen without CRA can't get the proptable to show unless I configure react-docgen-typescript-loader on my own with storybook's webpack.

from presets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.