Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit e55d2a2

Browse files
authored
Fix handling of build flag and empty env
`./scripts/build.js --libsass_ext=auto` resets `libsass_*` whereas it should not. This patch drops the env vars that have not been set at all.
1 parent 2513e6a commit e55d2a2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

scripts/build.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ function afterBuild(options) {
5656
*/
5757

5858
function build(options) {
59-
var args = [require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js')), 'rebuild', '--verbose'].concat(
60-
['libsass_ext', 'libsass_cflags', 'libsass_ldflags', 'libsass_library'].map(function(subject) {
61-
return ['--', subject, '=', process.env[subject.toUpperCase()] || ''].join('');
62-
})).concat(options.args);
59+
var libargs = [];
60+
['libsass_ext', 'libsass_cflags', 'libsass_ldflags', 'libsass_library'].forEach(function(subject) {
61+
var env = process.env[subject.toUpperCase()];
62+
if (env != null) libargs.push(['--', subject, '=', env].join(''));
63+
});
64+
var args = [require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js')), 'rebuild', '--verbose']
65+
.concat(libargs)
66+
.concat(options.args);
6367

6468
console.log('Building:', [process.execPath].concat(args).join(' '));
6569

0 commit comments

Comments
 (0)