-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
Line 8 in 7b4c476
| if (useGlobalLibvips() || process.env.npm_config_build_from_source) { |
Other packages, such as gdal-async, use this variable as a mechanism to indicate to the package that it must build from source. Said packages, as a convention, look for the presence of their package name within the value which is a more robust implementation that plays nice within the ecosystem, than simply looking at the presence of the env var.
It would be most excellent if Sharp could do the same, e.g.:
const buildFromSource = process.env.npm_config_build_from_source;
if (useGlobalLibvips() || (buildFromSource && buildFromSource.includes('sharp'))) {
process.exit(1);
}
This would improve the install experience and prevent consumers from having to install and rebuild in multiple steps to overcome Sharp's implementation.
For example, we have to do the equivalent of the following:
// Installs sharp as we would like, but gdal-async is not bound to our versions of gdal
npm install
// Rebuild Gdal Async bound to our versions of GDAL.
npm_config_build_from_source=gdal-async npm_config_shared_gdal=true npm rebuild gdal-async
Thank you!
Reactions are currently unavailable