-
Notifications
You must be signed in to change notification settings - Fork 55
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
"includes" configuration option to add other sibling source roots? #504
Comments
Can you explain what this means? For instance, what does an import look like from lets say |
The import looks like
Then, somewhere in our Webpack config we have
|
Okay, cool. Is import-js picking up exports from the |
Oh, wait. Maybe there is a |
They aren't found at all, and yes, you're exactly right - there is a |
I understand the issue. Having an One workaround I can think of is to try adding symlinks inside the different apps folders. If I'm not mistaken, watchman will traverse symlinks as well. |
Cool, I'll try the symlinks option and report back. Re: watchman's requirement for a common root, is it necessary to watch the sibling projects? Could it work with the assumption that changes to the sibling directories requires a restart of the daemon? Thanks for being so responsive! |
I guess that would work given that we document it properly with the potential addition of |
Unfortunately the symlinks approach does not seem to work. I verified that it does work when I copy the directory instead of creating the symlink. It doesn't look like
|
Actually I think I was mistaken about the Just documenting a version of the copying hack for future reference:You could use https://github.com/wix/wml to do
Add |
Interesting, thanks for trying it out. I recently worked in a project which made use of Lerna (https://github.com/lerna/lerna) and import-js was able to resolve imports across sibling packages. And if I'm not mistaken, Lerna uses symlinks to "bootstrap" package dependencies. Ninja edit: I just realize in a Lerna setup the "shared" packages are listed as dependencies in package.json. When import-js resolves imports from package dependencies, it doesn't use watchman. It simply grabs exports directly from the Another way to solve the problem you have could be to allow the watchman root to be overridden in config. I'd be happy to review a PR exploring a solution. |
I think that one difference from the lerna setup is that our sibling root is not a package -- it isn't exporting everything from under it in an index file. Since #344 is still open, my guess is that this approach won't work without adding a burden of changing the exports. |
I was looking for a somewhat similar solution, with this kind of monorepo structure (Meteor environment):
Each app has it's own To use ImportJS with the Meteor packages, I have to temporarily move the package directory over to one of the app folders, run the batch ImportJS command, then move the package directory back to |
In our set up, we have a 'shared' directory that applies to multiple of our "apps"
something like,
and we use Webpack to resolve across these directories.
How would I convince
import-js
to look in these other locations? Would it make sense to add anincludes
configuration option analogous toexcludes
?The text was updated successfully, but these errors were encountered: