electron-toolkit icon indicating copy to clipboard operation
electron-toolkit copied to clipboard

fix(tsconfig): update module and moduleResolution to Node16

Open mefengl opened this issue 10 months ago • 0 comments

Description

I applied this change in my project, and it fixed the electron-store type issue, so I’m making a PR here.

quote from https://github.com/cawa-93/vite-electron-builder/issues/997#issue-2291461319 :

Hello 👋,

Thanks for this awesome template and the latest move to ESM. Great work so far!

When migrating my project to these latest changes I observed issues with the electron-store module. According to its maintainer, the .tsconfig of this template is not fully "ESM-compliant". They suggest to change the moduleResolution of the .tsconfig to node16 or nodenext. I have created a repository using this template to reproduce the problem: raphaelmenges/electron-store-type-error

Additional context

Have run pnpm typechecker found some type error like below, but it not bought by this commit, so leave it unfix.

pnpm typechecker errors
	packages/playground/src/main.mts:4:40 - error TS2307: Cannot find module '@electron-toolkit/utils' or its corresponding type declarations.
4 import { optimizer, electronApp } from '@electron-toolkit/utils'
                                         ~~~~~~~~~~~~~~~~~~~~~~~~~

packages/playground/src/preload.mts:2:29 - error TS2307: Cannot find module '@electron-toolkit/preload' or its corresponding type declarations.

2 import { electronAPI } from '@electron-toolkit/preload'
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 2 errors in 2 files.

Errors  Files
     1  packages/playground/src/main.mts:4
     1  packages/playground/src/preload.mts:2
 ELIFECYCLE  Command failed with exit code 2.

What is the purpose of this pull request?

  • [x] Bug fix
  • [ ] New Feature
  • [ ] Documentation update
  • [ ] Other

Before submitting the PR, please make sure you do the following

mefengl avatar Dec 09 '24 04:12 mefengl