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.

Persistent cache throws warning about build dependency resolution because it's missing a \u0000 char

See original GitHub issue

Bug report

What is the current behavior?

webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Resolving '.pnpm/es5-ext@0.10.53/node_modules/es5-ext/array/#/clear' in /Users/scamden/creditiq/uno/common/temp/node_modules/.pnpm/es6-iterator@2.0.3/node_modules/es6-iterator for build dependencies doesn't lead to expected result '/Users/scamden/creditiq/uno/common/temp/node_modules/.pnpm/es5-ext@0.10.53/node_modules/es5-ext/array/#/clear.js', but to '/Users/scamden/creditiq/uno/common/temp/node_modules/.pnpm/es5-ext@0.10.53/node_modules/es5-ext/array/#/clear.js' instead. Resolving dependencies are ignored for this path.

warning on writing persistent cache in development mode if the dep has a # in the path and has already been loaded by node prior to dependency resolution for the cache.

If the current behavior is a bug, please provide the steps to reproduce.

https://github.com/creditiq/simple-repros/tree/webpack-cache-resolution-warning

Repro:

  1. Clone the above
  2. npm i
  3. cd nested
  4. npm run build

(note: this branch also contains a repro for bug: https://github.com/webpack/webpack/issues/12156, if you do the same steps but replace step 3 with cd \#nested)

Result: warning above

Expected: no warning

I have tracked the bug down to a \u0000 in the resolved result (that was added by webpack code when escaping the # one stack frame above the warning) that is not there in the job.expected value.

The expected value in my case was resolved via the require.cache inside the RBDT_FILE_DEPENDENCIES job as a RBDT_RESOLVE_CJS_FILE_AS_CHILD. I checked every path and child path one level deep in that cache and not one value had a \u0000 in it so I’m guessing the fix is to escape # with \0 when the file was found in the require.cache, but the code is a bit over my head so hopefully this lead gives someone more familiar a light bulb. Maybe alternatively the expected and result values should be compared with any \0 stripped out. Hopefully a maintainer will know 😬 I’ve made a PR https://github.com/webpack/webpack/pull/13149 for the latter because it feels lower risk, but if the right solution is to add escaping to paths found in the require.cache, I’m happy to do that instead 😃

webpack version: 5.31.0 Node.js version: 14.16.0 Operating System: Mac OS X Catalina Additional tools:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
scamdencommented, Apr 15, 2021

@alexander-akait ok tried again. this fixes both bugs but it does seem odd to have to reverse this intentional escaping…

1reaction
scamdencommented, Apr 15, 2021

Cool. Closed it. Just a stab 😃 not 100% sure this is a dupe though because I’m not seeing any problem resolving… or maybe it wouldn’t resolve when it goes to validate the cache later?

It seems like these \0’s are added on purpose by enhanced-resolver but I’m not sure why or where they are meant to be removed / how they are intended not to break resolution. I can dig in a little further if it will help resolve this quicker (no pun intended) but I’m very unfamiliar with this code.

Let me know if you think it’s worth my time or if I should just wait for a core maintainer to fix this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

persistent cache build dependency warning when "module ...
I have cache.type = 'filesystem'. When the build dependencies are scanned, I get a warning that 'module' can't be resolved:.
Read more >
Caching Dependencies
These errors are often caused by missing users, users with different UIDs, and missing paths. Use extra care when caching files in these...
Read more >
Bug listing with status CONFIRMED as at 2022/12/26 10:46:31
status:CONFIRMED resolution: severity:enhancement · Bug:21509 - "[PATCH] [IDEA] Ability to cleanly stop emerging multiple packages after the current jobs ...
Read more >
Fix list for IBM WebSphere Application Server V8.5
IBM WebSphere Application Server provides periodic fixes for the base and Network Deployment editions of release V8.5. The following is a complete listing ......
Read more >
JNI tips | Android NDK
If performance is important, it's useful to look the values up once and cache the results in your native code. Because there is...
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