create-electron-vite icon indicating copy to clipboard operation
create-electron-vite copied to clipboard

'require' is declared but its value is never read.

Open MS90D3V opened this issue 10 months ago • 1 comments

First time using this template. I get this error:

electron/main.ts:6:7 - error TS6133: 'require' is declared but its value is never read.
6 const require = createRequire(import.meta.url)
        ~~~~~~~
Found 1 error in electron/main.ts:6

Fixed by removing the const require = createRequire(import.meta.url) which seems to be unused?

MS90D3V avatar Mar 02 '25 16:03 MS90D3V

This is for modules that only support cjs (for example, native modules like better-sqlite3). If you don't need it, just remove it.

yanglee2421 avatar May 01 '25 14:05 yanglee2421