-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat(remix-dev): only purge require cache if updated #2046
Conversation
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
@warmpigman Could you please rebase your branch onto latest |
@MichaelDeBoey I think I did so, could you check? |
for (let key in require.cache) { | ||
if (key.startsWith(buildPath)) { | ||
delete require.cache[key]; | ||
if (require.cache[buildPath + "/assets.json"]?.exports.version !== JSON.parse(require('fs').readFileSync(BUILD_DIR + '/assets.json')).version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make this an early return please?
This will create a positive condition (which has a lower cognitive load) + will make sure the code is less nested.
I'm excited to see this get fixed, but does this approach still work? As far as I can tell, Remix stopped creating that assets.json file as of v1.2.0. |
What about this approach ? |
Superceded by #5133 |
Fixes #1818 Check version of assets.json, if it has changed, then purge require cache.