PackFileCacheStrategy warnings with global Promise hook
See original GitHub issueBug report
What is the current behavior?
I was runing a nextjs project with webpack5. When I added following code
class HookPromise extends Promise {}
global.Promise = HookPromise
I got some warnings like
<w> [webpack.cache.PackFileCacheStrategy] Restoring failed for Compilation/codeGeneration|external "@babel/runtime-corejs2/core-js/parse-int"|webpack-runtime from pack: Error: A lazy value that has been unmemorized can't be called again
<w> [webpack.cache.PackFileCacheStrategy] Restoring failed for Compilation/codeGeneration|external "next/dist/server/image-config.js"|webpack-runtime from pack: Error: A lazy value that has been unmemorized can't be called again
<w> [webpack.cache.PackFileCacheStrategy] Restoring failed for Compilation/codeGeneration|external "next/dist/shared/lib/to-base-64.js"|webpack-runtime from pack: Error: A lazy value that has been unmemorized can't be called again
<w> [webpack.cache.PackFileCacheStrategy] Restoring failed for Compilation/assets|chunkpages/blog from pack: Error: A lazy value that has been unmemorized can't be called again
If the current behavior is a bug, please provide the steps to reproduce.
see above
What is the expected behavior?
in lib/cache/PackFileCacheStrategy.js
:
if (value instanceof Promise) {
...
}
I changed the conditional statement, the warnings were disappeared
if (value && typeof value.then === 'function') {
...
}
Other relevant information: nextjs version: 11.1.2 webpack version: nextjs bundled version Node.js version: 14.16.0 Operating System: mac os 11.4 Additional tools:
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
<w> [webpack.cache.PackFileCacheStrategy] Caching failed ...
Simply creating a new Next.js project and running yarn dev / npm run dev logs the following warning in the console: [webpack.cache.PackFileCacheStrategy] ...
Read more >Cache - webpack
warning. The final location of the cache is a combination of cache.cacheDirectory + cache.name . cache.cacheLocation. string. Locations for the cache.
Read more >webpack/webpack - Gitter
Hi! I am facing some issue with webpack. I am working setting up a javascript development environment. I used extract-text-plugin in my webpack.config.prod....
Read more >I'm having this weird webpack.cache.PackageCacheStrategy
Here is global.scss mentioned in the error. When I try to removed the tailwind imports, it compiles without a problem. But I needed...
Read more >Writing a React hook to cancel promises when a component ...
I love how hooks let you write clean React code. Here is how you would use a cancelable promise hook inside a functional...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, PR welcome
Example of fix inside the issue, we should change
value instanceof Promise
onvalue && typeof value.then === 'function'