Closed Serg-Mois closed 4 years ago
Is there any other way to send index.html if no Controllers were found? I was trying to make:
@Controller('')
export class ClientController {
@Get('*')
public angularApp(@Res() res: Response): any {
res.sendFile(path.join(__dirname, './client/index.html'));
}
}
and put this Controller as the last one in controllers array of Module , but as described here https://github.com/nestjs/nest/issues/1667 - the order doesn't matter.
Don't use the production mode in webpack to bundle server-side applications. This may cause issues with numerous libraries, including typeorm, sequelize-typescript or NestJS.
Hello, I've taken your example https://github.com/nestjs/nest/tree/master/sample/24-serve-static, and added webpack builder in order to bundle everything in one file.
When build with 'production' mode set in webpack - there is an exception in runtime:
but, if mode in webpack is commented - everything works fine.
In node_modules\@nestjs\serve-static\dist\serve-static.module.js
httpAdapterHost in runtime is
see code here. https://github.com/Serg-Mois/serve_static_webpack_bug
also, when build with webpack - you need explicitly add "fastify-static" into dependencies.