Skip to content

Commit

Permalink
Check for dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic committed Jan 8, 2025
1 parent 6be0664 commit 1510b9e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/astro/src/content/vite-plugin-content-virtual-mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ export function astroContentVirtualModPlugin({
dataStoreFile = getDataStoreFile(settings, env.command === 'serve');
},
buildStart() {
// We defer adding the data store file to the watcher until the server is ready
devServer.watcher.add(fileURLToPath(dataStoreFile));
// Manually invalidate the data store to avoid a race condition in file watching
invalidateDataStore(devServer);
if (devServer) {
// We defer adding the data store file to the watcher until the server is ready
devServer.watcher.add(fileURLToPath(dataStoreFile));
// Manually invalidate the data store to avoid a race condition in file watching
invalidateDataStore(devServer);
}
},
async resolveId(id) {
if (id === VIRTUAL_MODULE_ID) {
Expand Down

0 comments on commit 1510b9e

Please sign in to comment.