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.

No hash value causes the cache problem

See original GitHub issue
Describe the issue / bug.

No hash value causes the cache problem

How can I reproduce this problem?

assets/image/a/1.png assets/image/b/1.png when you use both at the same time, a/1.png will be replaced by b/1.png because their names are the same

bugfix
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        use: {
          loader: 'url-loader',
          query: {
            limit: 10000,
            name: 'imgs/[name].[hash:7].[ext]'
          }
        }
      },

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
SimulatedGREGcommented, Aug 17, 2017

The problem that @chenweiqun originally mentioned would produce the following output, which contains only 1 logo.png instead of 2 different logo.pngs.

Hash: 1f29967d01d8a29a16de                                                           
Version: webpack 2.7.0
Time: 9768ms
                              Asset       Size  Chunks             Chunk Names
                      imgs/logo.png    61.9 kB          [emitted]  
                        renderer.js     100 kB       0  [emitted]  renderer
                         styles.css    1.25 kB       0  [emitted]  renderer
                         index.html  352 bytes          [emitted]  

Because both a/logo.png and b/logo.png have the same filename, only the latter is produced since a/logo.png gets overwritten by b/logo.png. Applying the [path] can ensure both assets are properly produced. It would be worth creating a PR to file-loader to create another hashing option based on the file path.

Should we support such use case? Your change impacts other users, and it is questionable for me, because it is clearly stated, that static files should be in the static, and src for text source files.

This is more of a webpack situation, as it is able to step into all component file imports and pass them through to url-loader/file-loader. Importing assets inside components through vue-loader and/or accessing them directly from static/ is a vuejs-templates/webpack implementation that has been adopted by many users. Supporting both is necessary for certain frameworks that can internally require their own assets, therefore allowing webpack to further optimize outputs when possible. electron-vue mirrors that approach already, so the above change does not impact users. In the end, src is not just for text files.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why doesn't String's hashCode() cache 0? - Stack Overflow
The value zero is reserved as meaning "the hash code is not cached". What is the probability that a Java string hashes to...
Read more >
Caching issues - Streamlit Docs
Streamlit raises this error whenever it encounters a type it doesn't know how to hash. This could be either when hashing the inputs...
Read more >
Error message re: cache, hash | WordPress.org
Initially, I got one or two instances of a nonce error message. I then got repeated errors citing cache-related issues, possible changes to...
Read more >
Bust That Cache Through A Content Hash - Alain Schlesser
The problem with this approach is that depending on what servers the visitor's connection is passing through, the assets will not be cached...
Read more >
Query task [hash] results not found in cache (Community)
This problem can arise when, while the underlying queries are running, the cache for one or more of the source queries expires. For...
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