Skip to content
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

stackblitz requires to install optional dependencies #1494

Closed
satanTime opened this issue Jun 5, 2021 · 1 comment
Closed

stackblitz requires to install optional dependencies #1494

satanTime opened this issue Jun 5, 2021 · 1 comment

Comments

@satanTime
Copy link

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

@kc0tlh
Copy link
Collaborator

kc0tlh commented Aug 23, 2023

@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!

@kc0tlh kc0tlh closed this as completed Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants