[6.0] when renaming preview.js to .ts the preview config is not found
Describe the bug
In my package.json I have "prestart": "sb-rn-get-stories". The file storybook.requires.js gets updated with the new detected stories files but unfortunately it loses some useful content.
To Reproduce Steps to reproduce the behavior: Default setup from here with add-ons (I use controls, notes, backgrounds and actions)
Expected behavior
The file storybook.requires.js keeps all the needed content and only append new stories but sb-rn-get-stories causes the file to lose this part:
import { decorators, parameters } from "./preview";
if (decorators) {
decorators.forEach((decorator) => addDecorator(decorator));
}
if (parameters) {
addParameters(parameters);
}
So I need to manually edit the file every single time to re-add that part.
Screenshots
.
hey @CezarCobuz that code gets injected if you have a preview.js file, is there a preview.js still present in your project?
It is but I renamed it to preview.ts
It is but I renamed it to
preview.ts
unfortunately that's whats causing the issue since it's looking specifically for preview.js
see here: https://github.com/storybookjs/react-native/blob/e2d3c5a9554fda186e80143a8642473bd7c18dc6/app/react-native/scripts/loader.js#L46-L47
However I'm happy to adjust this to better support ts extensions.
Got it, thank you @dannyhw!
Any progress here?
@zakharchenkoAndrii not worked on it yet but the change should be relatively simple should someone wish to contribute. I'm currently away but I can take a look in a weeks time to see about adding the ts,jsx and tsx file extensions to the script.
I did a PR #374, take a look please :)
Merged