fix: statyk watcher
Opened this issue · 4 comments
The watcher doesn't seem to rebuild pages with new content, instead only rebuilds with old cache.
Didn't check the codebase yet but if at any place you're using require, that can be issue. You can clear require cache https://github.com/abelljs/abell/blob/main/src/commands/serve.js#L133
Ahh interesting. Thanks I'll try it out. although have to consider also about ESM modules, there currently doesn't seem any way to access module cache nodejs/help#2806
are you using esm with the "module" keyword in package.json? or is it bundled?
You can also console.log(require.cache)
to check if the modules are cached there or not.
Oh came across similar issue in Abell v1. This time with import
.
You can clear the normal import cache with-
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
// ....
delete require.cache['./your-module.js']
and dynamic import cache with
import('./your-module?update=' + Date.now())
This article has some information - https://ar.al/2021/02/22/cache-busting-in-node.js-dynamic-esm-imports/