Hard dependency on fastify
See original GitHub issueI’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:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top 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 >fastify-micro - npm
Opinionated Node.js microservices framework built on fastify. Latest version: 3.1.1, last published: 10 months ago.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes it uses webpack for sure. I will push you something to GitHub tomorrow. Thank you in advance
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 usingexternals: []
). You can find somewhat more complex example here https://github.com/nestjs/ng-universal/issues/115