Default export and storybook csf

I’m trying to define storybook stories in the new CSF format

I want the default export to be a js object, like this:

let default = {"title": "My/Section"}

but I got an extra named export that conflicts with storybook, see https://rescript-lang.org/try?code=DYUwLgBAJiBmCGBXYkC8EDeEBEYCWYo2AXDgEbDwXzYQC+QA

exports.$$default = $$default;
exports.default = $$default

For storybook, named exports represent a story and it incorrectly generate a new entry named “Default” that fails when opened.

My question is what is the purpose of the additional export in that case ?
is it the intended behavior or a bug in rescript-compiler ?

I’m using %raw as a workaround but using a simple let default would be awesome

I found that I can use an ‘excludeStories’ for my problem.
I have created a Csf module with:

let config = (~excludeStories=Js.Re.fromString("\$\$default|.*Data$"), title:string) => {
    "title": title,
    "excludeStories": excludeStories
};

and I can use it like this:

let default = Csf.config("My/Section");

but still, why a $$default named export ?

@hgiraud Thanks for sharing your Csf workaround here.

I’m currently working on implementing Storybook within a ReScript app but running into issues with getting a component’s documentation to show up (even when using genType). Did get this to work by chance and mind sharing what you did?

@thislogancall Sorry, I’m not using the doc addon

No worries, thanks for hitting me back!