Skip to content

stackblitz requires to install optional dependencies #1494

Closed
@satanTime

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

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