Closed stillnurs closed 2 months ago
The correct syntax is viteConf.server.watch = { usePolling: true }
.
When doing watch.usePolling = true
, you assume that watch
is not undefined
, which is the case here.
As @Dtsiantaris pointed out, the config might be undefined
and the error is precisely pointing to that. However, the solution above is not the safest as watch
can be filled in the future, but you would override all the properties. So, the safest way would be this:
import { mergeConfig } from 'vite' // or require() equivalent
// ...
extendViteConf(viteConf) {
viteConf.server = mergeConfig(viteConf.server, {
watch: {
usePolling: true,
}
})
},
What happened?
Hot reload was not working. Tried to set "extendViteConf.usePolling" to true.
App cannot run, receiving error.
What did you expect to happen?
Expected to run my app, but getting current error.
"viteConf.server.watch.usePolling = true; ^
TypeError: Cannot set properties of undefined (setting 'usePolling')"
Reproduction URL
https://stackblitz.com/edit/quasarframework-po5slw?file=quasar.config.js
How to reproduce?
In quasar.config.js Set build settings:
Then run the app.
Flavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite), TypeScript Support, SPA Mode
Platforms/Browsers
No response
Quasar info output
Relevant log output
No response
Additional context
No response