-
-
Notifications
You must be signed in to change notification settings - Fork 292
Open
Labels
Description
Describe the bug
I'm struggling with migrating from Ts.ED 7 to Ts.ED 8.
The issue is I'm getting this error when configuring Pug template engine:
event: 'PLATFORM_VIEWS_ERROR',
message: 'Unable to configure the PlatformViews service on your environment.',
error: TypeError: Cannot read properties of undefined (reading 'render')
at file:///Users/evgeny/Projects/orig/node_modules/@tsed/platform-express/lib/esm/components/PlatformExpress.js:174:54
at Array.forEach (<anonymous>)
at PlatformExpress.configureViewsEngine (file:///Users/evgeny/Projects/orig/node_modules/@tsed/platform-express/lib/esm/components/PlatformExpress.js:173:44)
at async PlatformExpress.beforeLoadRoutes (file:///Users/evgeny/Projects/orig/node_modules/@tsed/platform-express/lib/esm/components/PlatformExpress.js:64:9)
at async PlatformBuilder.runLifecycle (file:///Users/evgeny/Projects/orig/node_modules/@tsed/platform-http/lib/esm/common/builder/PlatformBuilder.js:145:9)
at <anonymous> (/Users/evgeny/Projects/orig/src/index.ts:22:20)
Views config
views: {
root: join(process.cwd(), "src/views"),
viewEngine: "pug",
extensions: {
pug: 'pug'
}
}
What I’ve checked:
pug
is installed innode_modules
- View files exist in the correct location (
src/views
) @tsed/platform-express
is correctly imported and loaded- Code worked fine on Ts.ED v7
- Running in ESM mode with
swc-node
Expected behavior
I expect .pug
templates to be rendered using the @View()
decorator or res.render(...)
, like:
@View("home.pug")
@Get("/")
get() {
return { message: "Hello from Pug!" };
}
To Reproduce
- Create a new Ts.ED 8 project
- Install
pug
:npm install pug
- Configure views in
Server.ts
:views: { root: join(process.cwd(), "src/views"), viewEngine: "pug", extensions: { pug: "pug" } }
Expected behavior
Pug templates render
Code snippets
Repository URL example
No response
OS
Macos
Node version
22
Library version
8.14.1
Additional context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
To do