Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

273
Views
EJS File having trouble finding script file after converting JS project to Typescript

Folder structure:

  • root:
    • dist:
      • FOLDER 'models' (models for mongoose/mongodb)
      • this is also where I store the Typescript compiled JS files, such as script.js.
    • src
      • FOLDER 'models' files to be compiled for mongoose models
      • FOLDER 'assets' (photos, thumbnails, etc)
      • FOLDER 'css' (for the entire project)
      • This is where these files live: server.ts, script.ts, and other misc scripting files that all get compiled by typescript.
    • FOLDER 'views':
      • EJS layouts and body files. For example, layout.ejs and home.ejs (body of layout.ejs)
    • also at root are: package-lock.json, .env, .gitignore, package.json, and tsconfig.json

Now onto the problem i'm facing...

I'm very new to Typescript but was able to convert many of these files including server.js and script.js (the main two files of this program) to Typescript. They currently have no errors pre-compilation, but the home.ejs file (in views) can not find the script.js file.

When using in my ejs files, should i aim to the script.js that has been compiled down? Or should I aim to the script.ts in my src folder? I was able to link to the script.js but when I converted the file to TS, the EJS file can no longer find it in browser.

Here is the code that is relevant for my home.ejs file:

<body>

 <script src="/dist/script.js"></script>
 <script src="/launch.js"></script>

</body>

And here is a screenshot, if it helps, of my current structure: Image of folder structure

For the line, I have tried all of these but they don't work:

<script src="/dist/script.js"></script>
<script src="./dist/script.js"></script>
<script src="../dist/script.js"></script>
<script src="../../dist/script.js"></script>

Also knowing if node should run the server.js (compiled) file or the server.ts (uncompiled) would be helpful!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!