question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hard dependency on fastify

See original GitHub issue

I’m submitting a…


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Error: Module not found: Error: Can't resolve 'fastify-swagger' in '...\node_modules\@nestjs\swagger\dist'

Expected behavior

Should just work, when following the getting started guide 😃

Minimal reproduction of the problem with instructions

Set up nest using @nestjs/ng-universal with express and follow this guide https://docs.nestjs.com/openapi/introduction

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

I want to add openpi to my project. But when I follow the guide from docs i face the error above. I am not using fastify.

Environment


"@nestjs/common": "^7.0.0",
"@nestjs/swagger": "^4.8.2",
"@nguniversal/express-engine": "^12.1.0",
"express": "^4.15.2",
 "@angular/core": "~12.1.0",

For Tooling issues:
- Node version: v14.17.0
- Platform:  Windows

Others:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mbeckenbachcommented, Jul 2, 2021

Yes it uses webpack for sure. I will push you something to GitHub tomorrow. Thank you in advance

0reactions
kamilmysliwieccommented, Jul 5, 2021

https://github.com/nestjs/swagger/issues/1334#issuecomment-836488125

Long story short: webpack tries to bundle all deps referenced in your code (and libraries you use), even if you’re not actually using them (static analysis). Therefore, you must explicitly exclude these that you don’t use if you want to bundle your application. For this, you’ll have to provide a custom webpack configuration (setting the fastify-swagger as an external package using externals: []). You can find somewhat more complex example here https://github.com/nestjs/ng-universal/issues/115

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Migrate Your App from Express to Fastify - SitePoint
Required dependencies. First, let's create a new project: mkdir express-to-fastify-migration cd express-to-fastify ...
Read more >
Updating your Node apps for Fastify 4 - Glitch Help Center
1. Update to Node 14 · 2. Update Fastify · 3. Replace deprecated packages · 4. Update your Fastify server syntax · 5....
Read more >
Fastify v4 GA - Medium
In this new major, we focused on stabilizing the API, improving the developer experience, and upgrading our core dependencies, but this is not...
Read more >
Plugins - Fastify
Fast and low overhead web framework, for Node.js.
Read more >
fastify-micro - npm
Opinionated Node.js microservices framework built on fastify. Latest version: 3.1.1, last published: 10 months ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found