Skip to content

Chained module resolution during npm install #6424

Closed

Description

(related to #2338)

Problem

Install a TS module A, itself depending on another TS module B. npm flattens the dependency structure under node_modules and therefore the resolution algorithm implemented by #2338 is broken when module A is built.

How to repro

  1. clone https://github.com/erykwarren/ts-6424-repro
  2. npm install

The project includes dependency on module ts-lib2, which itself depends on ts-lib1. If you clone ts-lib2 by itself, and run npm install on it, it works. It's only when there's a chained dependency (with npm flattening the modules) that the problem occurs.

Assumptions

Each project is built as an npm postinstall step. I couldn't find out if there is a recommended way to accomplish this differently.

Activity

  1. vladima commented on Jan 9, 2016

    @vladima
    Contributor

    it looks like this issue is fixed in out latest bits, can you give a try to our nightly build (typescript@next) to see if you still can see this problem.

  2. erykwarren commented on Jan 9, 2016

    @erykwarren
    Author

    It works very nicely. Thanks Vladimir Matveev (@vladima).

  3. erykwarren commented on Jan 10, 2016

    @erykwarren
    Author

    Vladimir Matveev (@vladima) Is there anyway to port this fix in 1.7? If we have to wait for 1.8, what's the workaround?

  4. vladima commented on Jan 11, 2016

    @vladima
    Contributor

    this issue was fixed in two PRs: #5275 and #5461. I've ported them into release-1.7 in #6441, pinging Mohamed Hegazy (@mhegazy) for his decision if it is safe to take these changes.

  5. erykwarren commented on Jan 12, 2016

    @erykwarren
    Author

    Vladimir Matveev (@vladima) Thanks for pushing this. However, I tried building a custom TS with the patch in 6441, and it didn't solve the issue....

  6. erykwarren commented on Jan 12, 2016

    @erykwarren
    Author

    Vladimir Matveev (@vladima) Forget what I wrote, my test was wrong. It works! Thanks a lot.

  7. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions