Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempt to fix pnpm hard link issues #970

Merged
merged 2 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@

The [`@viewport`](https://www.w3.org/TR/css-device-adapt-1/#atviewport-rule) rule has been deprecated and removed from the web. Modern browsers now completely ignore this rule. However, in theory it sounds like would still work for mobile versions of Internet Explorer, if those still exist. The https://ant.design/ library contains an instance of the `@-ms-viewport` rule and it currently causes a warning with esbuild, so this release adds support for parsing this rule to disable the warning.

* Avoid mutating the binary executable file in place ([#963](https://github.com/evanw/esbuild/issues/963))

This release changes the install script for the `esbuild` npm package to use the "rename a temporary file" approach instead of the "write the file directly" approach to replace the `esbuild` command stub file with the real binary executable. This should hopefully work around a problem with the [pnpm](https://pnpm.js.org/) package manager and its use of hard links.

## 0.9.3

* Fix path resolution with the `exports` field for scoped packages
Expand Down
8 changes: 7 additions & 1 deletion lib/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,13 @@ function installDirectly(name: string) {
fs.copyFileSync(process.env.ESBUILD_BINARY_PATH, binPath);
validateBinaryVersion(binPath);
} else {
installBinaryFromPackage(name, 'bin/esbuild', binPath)
// Write to a temporary file, then move the file into place. This is an
// attempt to avoid problems with package managers like pnpm which will
// usually turn each file into a hard link. We don't want to mutate the
// hard-linked file which may be shared with other files.
const tempBinPath = binPath + '__';
installBinaryFromPackage(name, 'bin/esbuild', tempBinPath)
.then(() => fs.renameSync(tempBinPath, binPath))
.catch(e => setImmediate(() => { throw e; }));
}
}
Expand Down