0

I need to import hbs to use partials, but import * as hbs from "hbs" doesn't work, I use nest.js

Error: The partial header could not be found

my code:


async function bootstrap() {
  const app = await NestFactory.create<NestExpressApplication>(AppModule);

  app.setBaseViewsDir(join(__dirname, "..", "views"));
  app.setViewEngine("hbs");
  hbs.registerPartials(__dirname + "/views/partials");

  await app.listen(parseInt(process.env.PORT, 10) || 3000);
}
Sai Gummaluri
  • 1,340
  • 9
  • 16
Ekaterina
  • 11
  • 1

1 Answers1

1

I changed this line hbs.registerPartials(join(__dirname, "..", "/views/partials")); and it worked

Ekaterina
  • 11
  • 1