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

147
Views
Electron - Typescript - Cannot find module

Trying to build my electron app with typescript generated from the electron-quick-start-typescript project. I have added an additional module called auth.ts which is not recognised when I start the app. I am trying to reference it in renderer.ts with

import { myfunction } from './auth'

enter image description here

However I can see that it is getting converted into js. What could be causing this issue? Why can't my application see my new module?

enter image description here

Additionally here is my package.json file if that helps.

{
  "name": "electron-quick-start-typescript",
  "version": "1.0.0",
  "description": "A minimal Electron application written with Typescript",
  "scripts": {
    "build": "tsc",
    "watch": "tsc -w",
    "lint": "eslint -c .eslintrc --ext .ts ./src",
    "start": "npm run build && electron ./dist/main.js"
  },
  "repository": "https://github.com/electron/electron-quick-start-typescript",
  "keywords": [
    "Electron",
    "quick",
    "start",
    "tutorial",
    "demo",
    "typescript"
  ],
  "author": "GitHub",
  "license": "CC0-1.0",
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^4.33.0",
    "@typescript-eslint/parser": "^4.33.0",
    "electron": "^16.0.2",
    "eslint": "^7.32.0",
    "typescript": "^4.5.2"
  },
  "dependencies": {
    "node-fetch": "^2.6.1"
  }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Found the answer. For anyone else having the same issue this resolved the issue -

Make sure nodeIntegration is enabled in main.js

webPreferences: {
      nodeIntegration: true,
      preload: path.join(__dirname, "preload.js"),
    },

Index.html

replace:

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

with:

<script>
    require("./dist/renderer.js");
</script>
about 4 years ago · Juan Pablo Isaza Report
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!