[X] I have searched existing issues to ensure the bug has not already been reported
Fastify version
3.27.2
Plugin version
5.1.0
Node.js version
14.18.2
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
MacOS Big Sur v11.6.4
Description
I use path.join to convert my relative path to absolute path for the pug file.
When giving the relative path the template is rendered but when I give the file path that I joined using path.join I get ENOENT: no such file or directory error.
I tried setting root to / and baseDir to / but still got the same result.
Here's my plugin file:
module.exports = fp(async function (fastify, opts) { fastify.register(pointOfView, { engine: { pug: require('pug'), }, }); })
here's how I create the path and send it to the reply.view function:
const errorWidgetPath = path.join(__dirname, '../views/web/error.pug'); ... reply.view(errorWidgetPath, props);
Steps to Reproduce
Add Point-of-view as a plugin and use pug as engine.
create a path using path.join() function. // const errorWidgetPath = path.join(__dirname, '../views/web/error.pug');
render tha file from the path using reply.view // reply.view(errorWidgetPath, props);
Prerequisites
Fastify version
3.27.2
Plugin version
5.1.0
Node.js version
14.18.2
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
MacOS Big Sur v11.6.4
Description
I use path.join to convert my relative path to absolute path for the pug file. When giving the relative path the template is rendered but when I give the file path that I joined using path.join I get ENOENT: no such file or directory error.
I tried setting root to / and baseDir to / but still got the same result.
Here's my plugin file:
module.exports = fp(async function (fastify, opts) { fastify.register(pointOfView, { engine: { pug: require('pug'), }, }); })
here's how I create the path and send it to the reply.view function:
const errorWidgetPath = path.join(__dirname, '../views/web/error.pug'); ... reply.view(errorWidgetPath, props);
Steps to Reproduce
Expected Behavior
The template should be rendered.