Skip to content

Commit

Permalink
attempt to fix pnpm hard link issues (#970)
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw authored Mar 19, 2021
1 parent 356ea17 commit 53af085
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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

0 comments on commit 53af085

Please sign in to comment.