fastify / point-of-view

Template rendering plugin for Fastify
MIT License
338 stars 86 forks source link

eta v3 integration doesn't work #373

Closed dnohr closed 1 year ago

dnohr commented 1 year ago

Fastify version

4.18.0

Plugin version

7.4.1

Node.js version

20.3.0

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

Ventura 13.4

Description

Hi everyone,

Thank you for your work on the Fastify module. I appreciate it!

I wanted to let you know that eta has recently been updated to version 3.0.1. However, it seems that this update has caused a problem with the integration of the Fastify view module, as mentioned in this eta issue.

I'm not exactly sure what the issue is, but it's clear that something has changed and caused a disruption in the integration.

Thank you!

Steps to Reproduce

Node: 20.3.0 fastify: 4.18.0 fastify/view: 7.4.1 eta: 3.0.1

fastify.register(require('@fastify/view'), {
    engine: { eta: require('eta') }
});

Expected Behavior

The previous ETA version 2.2.0 works fine with the current Fastify code, but something has changed.

dnohr commented 1 year ago

The latest version of the Fastify view plugin (v8.0.0) and some updated ETA code did resolve the issue and make it work again.

Now, you need to initialize it differently, but it functions properly.

const { Eta } = require('eta');

fastify.register(require('@fastify/view'), {
    engine: { eta: new Eta() },
    root: `${__dirname}/views/`,
});

I will close this issue.

Thanks!