Skip to content

How to completely remove anything related to Storybook in release builds? #259

Answered by dannyhw
svbutko asked this question in Q&A
Discussion options

You must be logged in to vote

Using require inline is away of doing conditional imports that already works without babel. It would be best to do some testing but if you do the require in line after some condition it should be possible.

If(__DEV__) {
   const {configure} = require("@storybook/react-native");
   require("./storybook.config");
   configure(() => {
     require("./storybook/stories.ts");
   }, module);
}

Something like this could probably work. This is because requires aren't hoisted in the same way as imports (as far as I know)

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@svbutko
Comment options

@svbutko
Comment options

@dannyhw
Comment options

@svbutko
Comment options

Answer selected by svbutko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants