Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: statyk watcher #6

Open
anuraghazra opened this issue Jan 18, 2022 · 4 comments
Open

fix: statyk watcher #6

anuraghazra opened this issue Jan 18, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@anuraghazra
Copy link
Contributor

The watcher doesn't seem to rebuild pages with new content, instead only rebuilds with old cache.

@anuraghazra anuraghazra added the bug Something isn't working label Jan 18, 2022
@saurabhdaware
Copy link

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

@anuraghazra
Copy link
Contributor Author

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

@saurabhdaware
Copy link

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.

@saurabhdaware
Copy link

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants