Skip to content

stackblitz requires to install optional dependencies #1494

Closed

Description

@satanTime

Description of Bug

My library has several optional dependencies. The dependencies shouldn't be present at all.
Despite that stackblitz forces to install the dependencies and their dependencies, what is a bit strage.

Steps to Reproduce

  1. Go to https://stackblitz.com/github/ng-mocks/examples/tree/bug?file=package.json
  2. Wait
  3. See error

Expected Behavior

Because these dependencies are optional, a require call should throw an error, or return undefined and let the library solve the situation.

Screenshots/Screencast

an optional dependency is handled like that:

try {
  const jestCircus: any = require('jest-circus/build/state');
  if (jestCircus) {
    // some logic
  }
} catch (e) {
  // no dependency, therefore nothing to do
}

https://github.com/ike18t/ng-mocks/blob/master/libs/ng-mocks/src/lib/common/ng-mocks-stack.ts#L7-L16

Activity

  1. kc0tlh commented on Aug 23, 2023

    @kc0tlh
    Collaborator

    @satanTime, I was able to open your repo in our new VS Code editor without encountering the error you mention in Step 3. I'm going to preliminarily mark this issue as resolved, but feel free to comment & re-open if you are still experiencing the optional deps issue!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions