Skip to content

Commit 960fe78

Browse files
authored
Fix running babel and terser when there is no node in PATH. (#24450)
Fix running babel as part of the build when there is no node in PATH. Fixes test other.test_wasm_features.
1 parent 8ff3033 commit 960fe78

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

test/test_other.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,7 @@ def test_em_config_filename(self):
818818
create_file('myconfig.py', f'''
819819
LLVM_ROOT = r'{config.LLVM_ROOT}'
820820
BINARYEN_ROOT = r'{config.BINARYEN_ROOT}'
821+
NODE_JS = r'{config.NODE_JS[0]}'
821822
CACHE = r'{os.path.abspath("cache")}'
822823
print("filename", __file__)
823824
''')
@@ -11882,7 +11883,7 @@ def print_percent(actual, expected):
1188211883
# N.b. this requires node in PATH, it does not run against NODE from
1188311884
# Emscripten config file. If you have this line fail, make sure 'node' is
1188411885
# visible in PATH.
11885-
self.run_process(terser + ['-b', 'beautify=true', 'a.js', '-o', 'pretty.js'])
11886+
self.run_process(terser + ['-b', 'beautify=true', 'a.js', '-o', 'pretty.js'], env=shared.env_with_node_in_path())
1188611887
self.assertFileContents(js_out, read_file('pretty.js'))
1188711888

1188811889
obtained_results = {}

tools/building.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def transpile(filename):
535535
# Babel needs access to `node_modules` for things like `preset-env`, but the
536536
# location of the config file (and the current working directory) might not be
537537
# in the emscripten tree, so we explicitly set NODE_PATH here.
538-
env = os.environ.copy()
538+
env = shared.env_with_node_in_path()
539539
env['NODE_PATH'] = path_from_root('node_modules')
540540
check_call(cmd, env=env)
541541
return outfile

0 commit comments

Comments
 (0)