question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

loadable-components and webpack 5, incorrect content hashes in the stats file

See original GitHub issue

🐛 Bug report

Current Behavior

  1. yarn create razzle-app --example with-loadable-components my-project
  2. cd my-project
  3. yarn add --dev webpack@5.24.0 html-webpack-plugin@5.2.0
  4. yarn build

The build/loadable-stats.json content hashes do not align with the corresponding files’ content hashes.

Expected behavior

The loadable-stats.json content hashes align with the corresponding files’ content hashes.

Reproducible example

contenthash-mismatch

Suggested solution(s)

I’m assuming the issue involves the webpack config generated by razzle, but I am unsure.

Additional context

To confirm that it was not an issue with loadable-components and webpack 5, I created a minimal webpack.config.js in the project and was able to successfully compile the chunks with proper content hashes.

The example repo works properly with webpack 4.

Your environment

Software Version(s)
Razzle 4.0.3
Razzle Plugins N/A
Node v14.15.0
Browser N/A
Yarn 1.22.10
Operating System macOS 10.15.7
TypeScript N/A
React 17.0.1
Webpack 5.24.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
sumanbhcommented, Mar 26, 2021

This is a bug in loadable-components’s webpack plugin which is fixed in their main branch but still unreleased. See https://github.com/gregberge/loadable-components/issues/712

0reactions
fivethreeocommented, May 12, 2021

Fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server Side Rendering
This is the stats file generated by webpack loadable plugin. const statsFile = path.resolve('../dist/loadable-stats.json').
Read more >
loadable/componet not loading on server side rendering
json file is created with chunk hash values. What am I doing wrong here? javascript · reactjs · react-router · loadable-component.
Read more >
Caching
This guide focuses on the configuration needed to ensure files produced by webpack compilation can remain cached unless their content has changed.
Read more >
Webpack 5 release (2020-10-10)
Webpack 5 will use a real hash of the file content when using [contenthash] now. Before it "only" used a hash of the...
Read more >
Resolve
import Test1 from 'xyz'; // Exact match, so path/to/file.js is resolved and ... null-loader is deprecated in webpack 5. use alias: { xyz$:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found