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

Error if the cwd is not the root of the package that is transpiled with babel #5

Closed
leMaik opened this issue Oct 21, 2017 · 3 comments · Fixed by #6
Closed

Error if the cwd is not the root of the package that is transpiled with babel #5

leMaik opened this issue Oct 21, 2017 · 3 comments · Fixed by #6

Comments

@leMaik
Copy link
Contributor

leMaik commented Oct 21, 2017

This might be a very rare edge case, but I'd like to seet his fixed (a PR is on its way) and discuss this.

I have a react-styleguidist setup where I join multiple styleguides into one big styleguide. Each project (each individual style guide) uses babel and babel-plugin-direct-import. The problem is that when I build my big styleguide, babel does run from there and process.cwd() is not the root of every individual component anymore. This causes babel-plugin-direct-import not to find dependencies that are only used by individual components.

Long story short: process.cwd() not being the path of the module that uses babel-plugin-direct-import breaks it.

@avocadowastaken
Copy link
Owner

Good point, I was thinking about injecting cwd at the beginning (https://github.com/lodash/babel-plugin-lodash/blob/master/src/config.js#L17), but then decided to make it simpler.

@leMaik
Copy link
Contributor Author

leMaik commented Oct 21, 2017

Yeah, that would make the config syntax more complicated again and would require me to put the cwd into all .babelrc files.
The proposed PR doesn't require config changes. :-)

@avocadowastaken
Copy link
Owner

@leMaik yeah, I wrote it before I saw your PR , lets move our discussion there.

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

Successfully merging a pull request may close this issue.

2 participants