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

Stale statsFile #821

Closed
Dattaya opened this issue Aug 29, 2021 · 4 comments
Closed

Stale statsFile #821

Dattaya opened this issue Aug 29, 2021 · 4 comments

Comments

@Dattaya
Copy link

Dattaya commented Aug 29, 2021

🐛 Bug Report

I hot reload the server in my boilerplate and for some reason new ChunkExtractor({ statsFile }) loads old statsFile and it's not present in require.cache so clearModuleCache can't do anything much. Changing smartRequire in utils to JSON.parse(fs.readFileSync(modulePath)); fixes the problem. I can send a PR if you're interested.

To Reproduce

Tested on Linux, might not work on other OSs:

  • git clone https://github.com/Dattaya/ts-react-ssr-basis && cd ts-react-ssr-basis && npm i && npm start
  • Open http://localhost:3000/ and view page source (Ctrl+U in Chrome)
  • Modify common/components/App/index.tsx, save it, reload the page source and observe that script src= points to the old js file.

Expected behavior

ChunkExtractor.getScriptTags returns updated assets.

npx envinfo

## System:
 - OS: Linux 5.11 Ubuntu 20.04.3 LTS (Focal Fossa)
 - Shell: 5.0.17 - /bin/bash
## Binaries:
 - Node: 14.15.3 - ~/.nvm/versions/node/v14.15.3/bin/node
 - Yarn: 1.22.10 - ~/.nvm/versions/node/v14.15.3/bin/yarn
 - npm: 6.14.11 - ~/.nvm/versions/node/v14.15.3/bin/npm
## npmPackages:
 - @loadable/babel-plugin: ^5.13.2 => 5.13.2 
 - @loadable/component: ^5.15.0 => 5.15.0 
 - @loadable/server: ^5.15.1 => 5.15.1 
 - @loadable/webpack-plugin: ^5.15.1 => 5.15.1
@open-collective-bot
Copy link

Hey @Dattaya 👋,
Thank you for opening an issue. We'll get back to you as soon as we can.
Please, consider supporting us on Open Collective. We give a special attention to issues opened by backers.
If you use Loadable at work, you can also ask your company to sponsor us ❤️.

@Dattaya
Copy link
Author

Dattaya commented Oct 8, 2021

reopening, thought the issue was fixed by adding '@loadable/server' to webpackNodeExternals allowlist, but it's not the case. It was working, because I locally modified utils to leverage readFileSync.
I'll close this one, once #838 is released.

@Dattaya Dattaya reopened this Oct 8, 2021
@Dattaya Dattaya closed this as completed Nov 1, 2021
@rtymchyk
Copy link

rtymchyk commented Nov 1, 2021

@Dattaya What was the resolution here? Or did you end up using a local modification?

@Dattaya
Copy link
Author

Dattaya commented Nov 3, 2021

@rtymchyk, sorry for the delayed response. I changed my mind, because usually issues are closed when they're fixed, not when included in a new release. In the meantime you can modify util.js in node_modules manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants