Closed
Description
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
- Go to https://stackblitz.com/github/ng-mocks/examples/tree/bug?file=package.json
- Wait
- 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