-
-
Notifications
You must be signed in to change notification settings - Fork 433
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
Unable to set up a project to be provide shared interfaces/implementations for other projects #1055
Comments
I'm really sorry but I can't look into this myself. I notice you're using |
Thanks @johnnyreilly I meant to remove that line. I had added it later in my debugging. It actually has no impact on the error. I actually recall seeing that issue (hail Google), but it wasn't super clear to me what is or isn't supported yet. If anyone can point me to an example of how this sort of setup is supposed to be configured, I can work backwards. In my actual project I have 3 ts projects: client, server, interfaces, and I just want to avoid duplicating the interfaces. Honestly, if I can't get this to work, I'll just have a prebuild step physically copy (or link) the files into both client and server before packing, but this seems more elegant |
This doesn’t pass for me because |
That's strange. I will try again when I get home. I say it's strange because if it's not a peer dependency, then I would think npm pulls it down automatically. |
Looking at it again, you/I just need to install |
So, I’m not 100% sure why it was working with tsc, but I was able to fix it by moving the dependencies of both If you must treat each of these projects as separate packages with their own package.json and node_modules, I think using a tool like lerna would help, because it hoists common dependencies to the top level for you during development. So you get to keep the conceptual model of separate dependencies, but the reality on your file system essentially reflects the experiment I just did locally where I deleted |
Thanks @andrewbranch I suppose I can't think of a reason why I couldn't share modules, but in this case it seems like it is a best practice, and the official guidance for this sort of project. I suspect that there are sneaky ways around this issue by marking things as any in strategic places, to fool the type system, but who wants to do that? :). I'll look into lerna, but am still curious if anyone can spot where the issue is. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Closing as stale. Please reopen if you'd like to work on this further. |
Steps to Reproduce the Problem
This small test repo minimally reproduces the issue I'm seeing. It is using some packages provided for developing VS Code extensions. There is one package meant to be used for the client, and one for the server. The each define some of the same types using separate, but seemingly compatible definitions. In this case, the problem type is
RequestType
.npm install
npm run compile
(sanity check; this should pass)npm run webpack
Expected Behaviour
Actual Behaviour
Location of a Minimal Repository that Demonstrates the Issue.
https://github.com/kbirger/webpack-shared-test
Additional info
I have also tried configuring webpack's ts-loader as below:
In an attempt to get it to use the same configuration and load modules the same way. This makes no difference.
I understand this is likely an error in how I'm setting up my project, but I cannot find information on how to achieve what I am trying to do.
Also, it seems like overload 2 should be the correct one.
The text was updated successfully, but these errors were encountered: