vite
vite copied to clipboard
Error while `tsconfig.json` hot update
Describe the bug
I'm building an Electron App with Vite and when I update tsconfig.json
an error occurs.
🚨 Because this is an Electron application, it cannot be reproduced on StackBlite. But I still provide a minimal Demo. I hope you can clone electron-vite-vue to run locally, the reproduction steps are really simple. :)
- npm run dev
- modify
tsconfig.json
-
ctrl + s
save file
I explained the problem in great detail in this issue 👉 https://github.com/electron-vite/electron-vite-vue/issues/218
I submitted a PR to fix it #9412
Reproduction
https://stackblitz.com/edit/vite-plugin-electron?file=vite.config.ts
System Info
System:
OS: macOS 10.15.7
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Memory: 162.66 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 16.13.0 - /usr/local/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 8.1.0 - /usr/local/bin/npm
Browsers:
Chrome: 103.0.5060.134
Safari: 15.4
npmPackages:
@vitejs/plugin-react: ^2.0.0 => 1.3.2
vite: ^3.0.2 => 2.9.14
Used Package Manager
yarn
Logs
Click to expand!
/Users/atom/Desktop/github/electron-vite-react/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:19957
server.config.logger.info(`changed tsconfig file detected: ${changedFile} - Clearing cache and forcing full-reload to ensure typescript is compiled with updated config values.`, { clear: server.config.clearScreen, timestamp: true });
^
TypeError: Cannot read properties of null (reading 'config')
at FSWatcher.reloadOnTsconfigChange (/Users/atom/Desktop/github/electron-vite-react/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:19957:16)
at FSWatcher.emit (node:events:402:35)
at FSWatcher.emitWithAll (/Users/atom/Desktop/github/electron-vite-react/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:47126:8)
at FSWatcher._emit (/Users/atom/Desktop/github/electron-vite-react/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:47218:8)
at FsEventsHandler$1.handleEvent (/Users/atom/Desktop/github/electron-vite-react/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:46352:14)
at FsEventsHandler$1.addOrChange (/Users/atom/Desktop/github/electron-vite-react/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:46302:8)
at watchCallback (/Users/atom/Desktop/github/electron-vite-react/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:46406:21)
at filteredListener (/Users/atom/Desktop/github/electron-vite-react/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:46191:7)
at /Users/atom/Desktop/github/electron-vite-react/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:46216:11
at Set.forEach (<anonymous>)
error Command failed with exit code 1.
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.