Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Correctly load v8-compile-cache (#6261)
`v8-compile-cache` is not loading because `fs.existsSync` is checking for a file that doesn't exist. `fs.existsSync` resolves relative to the cwd, not the current module (like `require`), and `v8CompileCachePath`'s filename is missing `.js`. Instead of checking for the existence of `v8-compile-cache.js`, just try to `require` it in a `try`/`catch`, using a full path. Also switched the `require` of `cli.js` to use the same pattern for consistency (plus it's a module resolution micro-optimization). ``` # before $ time ./dist/bin/yarn -v 1.10.0-0 ./dist/bin/yarn -v 0.28s user 0.06s system 98% cpu 0.344 total # after $ time ./dist/bin/yarn -v 1.10.0-0 ./dist/bin/yarn -v 0.16s user 0.05s system 97% cpu 0.213 total ```
- Loading branch information