Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMPROVE storybook's compatibility to work within a monorepo #8822

Merged
merged 7 commits into from
Dec 21, 2019

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Nov 13, 2019

Issue: #3346 #5949

What I did

  • Change the exclude to a regex, this helps with monorepo support, because in monorepos the node_modules folders might be more then 1, and not in the same place always. making this a regex makes sure that we never transform something from a path that has node_modules in it.
  • Change the includes filter. In a monorepo storybook might be ran from a subdir in a monorepo, but files relevant for storybook might be higher up the tree. So I try to find the project root and include that.
  • Add sourceType=unumbiguous to babel options so it can load commonjs modules.

@vercel
Copy link

vercel bot commented Nov 13, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/storybook/monorepo/3hsm84bro
🌍 Preview: https://monorepo-git-tech-change-nodemodules-exclude.storybook.now.sh

@ndelangen ndelangen requested a review from shilman November 13, 2019 14:25
@ndelangen ndelangen changed the title CHANGE exclude to a regex matching all node_modules folder IMROVE storybook's compatibility to work within a monorepo Nov 15, 2019
@ndelangen ndelangen changed the title IMROVE storybook's compatibility to work within a monorepo IMPROVE storybook's compatibility to work within a monorepo Nov 15, 2019
export const nodeModulesPaths = path.resolve('./node_modules');
export const excludePaths = [nodeModulesPaths];
export const excludePaths = [/node_modules/];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that this line fixes my problems in a monorepo 🎉

# Conflicts:
#	lib/core/src/server/preview/iframe-webpack.config.js
@github-actions
Copy link
Contributor

Fails
🚫 PR is marked with "do not merge" label.

Generated by 🚫 dangerJS against a1726bf

@ndelangen ndelangen changed the base branch from next to next-6.0.0 December 20, 2019 23:45
@ndelangen ndelangen merged commit 8a9f09a into next-6.0.0 Dec 21, 2019
@ndelangen ndelangen deleted the tech/change-nodemodules-exclude branch December 21, 2019 12:00
@astrotim
Copy link

Is the next-6.0.0 branch available via npm?

@ndelangen
Copy link
Member Author

ndelangen commented Jan 10, 2020

no not yet, we'll start publishing alphas of it when 5.3 is published as latest

@shilman
Copy link
Member

shilman commented Jan 10, 2020

@astrotim Nope. I plan to release 5.3 this weekend and then cut over so that 6.0 gets released on the next NPM tag. Coming soon!

@astrotim
Copy link

OK great, I'm looking forward to taking it for a spin in our monorepo

@lucaslz2020
Copy link

lucaslz2020 commented Apr 8, 2020

Is there an example of how to use it? I have upgraded to 6.0.0-alpha.31

Module parse failed: Unexpected token (20:24)
You may need an appropriate loader to handle this file type, 
currently no loaders are configured to process this file. 
See https://webpack.js.org/concepts#loaders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants