-
Notifications
You must be signed in to change notification settings - Fork 449
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
Hard dependency on fastify #1414
Comments
Hi! As you can see here: Lines 36 to 40 in 491b168
fastify-swagger will be loaded only if your app is using fastify as a http adapter (ie, app.getHttpAdapter() will return an instance of FastifyAdapter ). The getting started guide looks fine to me, I've already followed it with no worries.
|
Hm... thats strange. Because i do not use fastify but still get to that error. As you can see below not even the package is installed. I get this error as soon as I add this to my main.ts: const config = new DocumentBuilder()
.setTitle('Cats example')
.setDescription('The cats API description')
.setVersion('1.0')
.addTag('cats')
.build();
|
I'm not familiar with ng-universal, but I would bet there's a webpack bundler going on under the hood that is trying to resolve |
Yes it uses webpack for sure. I will push you something to GitHub tomorrow. Thank you in advance |
@jmcdo29 I pushed it to https://github.com/mbeckenbach/nestswagrepro It will show you the error. The nestjs code base is in the /server folder. There is a custom-webpack.config.js in the project root used by the angular compiler to suppress some warnings from typeorm. It simply extends the webpack config that angular uses under the hood. npm run dev:ssr to start it. I think you don't need it, but just in case: this is an angular project using @angular/cli which i have installed globally. Thanks again for having a look! |
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 |
I'm submitting a...
Current behavior
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
The text was updated successfully, but these errors were encountered: