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": [
  "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"

1 answer

  • answered 2021-11-29 04:34 Christopher Townsend

    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"),



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



How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum