Build not including ejs files
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 9.8k
- Forks
- 326
- PR merge metrics
- No merged PRs in 30d
Description
for some reasons when i run build. i am getting build and i am able to run the application but the ejs files are missing in the build and i am getting template not found error attached is the error which i am getting when i am on the route

here is my project structure

and the code where i am using ejs is
import * as express from 'express';
import { isAuthenticated } from "@components/authentication/passport-strategies";
import appRoot from 'app-root-path'
class StaticSite {
constructor(server: express.Express) {
const router = express.Router();
server.set("views",`${appRoot.path}/src/public/views`);
server.set("view engine", "ejs");
server.engine('ejs', require('ejs').__express);
router.use('/login', async (req: express.Request, res: express.Response) => {
res.render('pages/login');
});
router.use('/pages/search',isAuthenticated, async (req: express.Request, res: express.Response) => {
res.render('pages/coveoSearch');
});
router.use('/', isAuthenticated, async (req: express.Request, res: express.Response) => {
res.render('pages/index');
});
server.use('/', router);
}
}
export default StaticSite;
and below is the router initalization in the application
import { Express } from 'express'
import { DocsServeRouter, HealthRouter, AuthRouter,StaticRouter } from '@routes/index';
export function initRouters(app: Express): void {
new HealthRouter(app);
new DocsServeRouter(app);
new AuthRouter(app);
new StaticRouter(app);
}
build commad which i am using
"build": "ncc build src/server.ts -o release -e typescript --source-map",
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ncc build src/server.ts -o release -e typescript --source-map command and the src/server.ts entry point, then trace how src/public/views is referenced by the Express setup. Verify the built release output and the /login, /pages/search, and / routes; done means the EJS templates are included and those routes no longer produce a template-not-found error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- express, node.js, typescript
- Domain
- backend, build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100