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

Change from optional to require-optional #3035

Closed
baflo opened this issue Sep 26, 2019 · 3 comments
Closed

Change from optional to require-optional #3035

baflo opened this issue Sep 26, 2019 · 3 comments

Comments

@baflo
Copy link

baflo commented Sep 26, 2019

Feature Request

Is your feature request related to a problem? Please describe.

The package optional requires packages relative to its own location, which may result in errors, if the application has a structure like this:

+ node_modules
| + optional
| + my-nest-server
|    + node_modules
|    | + @nestjs/common
|    | + @nestjs/core
|    | + @nestjs/websockets
|    + package.json
|    + server.js
+ app.js
+ package.json

Here, @nestjs/websockets won't be loaded, as it cannot be found by optional. Hence, nestjs won't initialize web-socket.

Some issues are also filed: #2213, #1149

Describe the solution you'd like

The package require-optional can be used as a dropin-replacement and resolves this issue, as it requires relative to the __filename the require was called.

Teachability, Documentation, Adoption, Migration Strategy

This can be used as a dropin replacement and shouldn't required special training.

What is the motivation / use case for changing the behavior?

Resolving filed issues and others...

@kamilmysliwiec
Copy link
Member

This PR will solve this issue #3041

@kamilmysliwiec
Copy link
Member

kamilmysliwiec commented Sep 30, 2019

Added in 6.8.0

@lock
Copy link

lock bot commented Dec 29, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants