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 stats when not using HotModuleReplacementPlugin #837

Closed
Mordred opened this issue Sep 23, 2021 · 7 comments
Closed

Stale stats when not using HotModuleReplacementPlugin #837

Mordred opened this issue Sep 23, 2021 · 7 comments

Comments

@Mordred
Copy link
Contributor

Mordred commented Sep 23, 2021

💥 Regression Report

Using module.hot is preventing cache clear if not using HotModuleReplacementPlugin or Webpack completely for server. (8f10896)

Last working version

Worked up to version: v5.14.2

Stopped working in version: v5.15.0 (commit 8f10896)

To Reproduce

Steps to reproduce the behavior:

Download example https://github.com/gregberge/loadable-components/tree/main/examples/server-side-rendering. Run npm run build:webpack -- --watch in one terminal and babel-node src/server/main.js in second.

Then change Test in App.js to Test 2 - you will get old bundles in the HTML and warning Text content did not match. Server: "Test 2" Client: "Test" if you refresh the page.

On v5.14.2 this is working as it should.

Expected behavior

There should be no warning and correct bundles after refresh.

@open-collective-bot
Copy link

Hey @Mordred 👋,
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 ❤️.

@kompolom
Copy link

kompolom commented Oct 4, 2021

It not working even if HotModuleReplacementPlugin enabled.
The module here is common nodejs module not webpack.

if (process.env.NODE_ENV !== 'production' && module.hot) {

@Mordred
Copy link
Contributor Author

Mordred commented Oct 4, 2021

@kompolom You have to add HotModuleReplacementPlugin and /^@loadable\/server/ to allowlist for nodeExternal:

configuration.externals = [
  nodeExternal({
    // @loadable/server - because it is using module.hot
    allowlist: [/^@loadable\/server/],
  }),
];

So that @loadable/server is compiled by Webpack. But it will not work till #838 is released.

I think that module.hot should be removed, because @loadable/server must work even you are not using Webpack to process your server code - see my To Reproduce section in first comment.

@Dattaya Dattaya mentioned this issue Oct 8, 2021
@stale
Copy link

stale bot commented Jan 3, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 3, 2022
@Mordred
Copy link
Contributor Author

Mordred commented Jan 7, 2022

This bug still exists

@stale stale bot removed the wontfix label Jan 7, 2022
@theKashey
Copy link
Collaborator

module.hot is used to understand that module cache can be accessed and operated with. There are better ways to do the same and clearModuleCache is already contain all required checks.

👍 module.hot should be removed

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 16, 2022
@stale stale bot closed this as completed Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants