Maybe easier swap between SB index and normal index root #494
Grohden
started this conversation in
Show and tell
Replies: 1 comment
-
Hey, yes I actually made a video about this before based on a comment I received on the blog post I wrote. It's totally doable to use the source extensions config option. I was planning to add it in written form to the blog but didn't get around to it Maybe you can write up your findings in a blog post? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thx for SB in RN, its really amazing!
I've been setting it up in an existing project (non expo), and, like some people, I'm trying to make it easier to swap what I'm bundling (while not accidentally shipping SB stories in my app)
After reading the linked blog posts, I came up with this idea and I think it might be worth mentioning it for discussion.
Our whole problem is that we need metro to pick a different entry file, but our nice friends at metro don't expose an option for that... However, we can explore a trick I've learned using detox: we can trick metro into picking a more specific file extension using the
assetsExts
field. Here's how my metro.config file looks like:With that, I can just add a
index.storybook.js
file + the needed env flag (STORYBOOK_ENABLED
), then metro will pick the right root entry for me :D (btw, If I already have aindex.android.js
orindex.ios.js
I just need to add another level of indirection)So, is that an idea to be considered? (cc @dannyhw since u wrote the blog post)
Btw, about the blog post I had problems with:
All of that was solved with the described approach since I'm not using metro/index inside another folder
Beta Was this translation helpful? Give feedback.
All reactions