Skip to content

Commit a7bf0bf

Browse files
authored
Fix a couple of issues with JS output caching (#25946)
- Skip caching of JS output in the presence of user JS libraries. - Include our core js files, since changing them should invalid the cache. Followup to #25942
1 parent cb44503 commit a7bf0bf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/emscripten.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ def generate_js_compiler_input_hash(symbols_only=False):
194194
if not symbols_only:
195195
files += settings.PRE_JS_FILES
196196
files += settings.POST_JS_FILES
197+
# Also include other .js files that could be included in the output.
198+
files += glob.glob(utils.path_from_root('src/*.js'))
197199

198200
for file in sorted(files):
199201
file_contents.append(utils.read_file(file))
@@ -340,7 +342,9 @@ def get_cached_file(filetype, filename, generator, cache_limit):
340342
def compile_javascript_cached():
341343
# Avoiding using the cache when generating struct info since
342344
# this step is performed while the cache is locked.
343-
if DEBUG or settings.BOOTSTRAPPING_STRUCT_INFO or config.FROZEN_CACHE:
345+
# Sadly we have to skip the caching whenwhere we have user JS libraries. This is because
346+
# these libraries can import arbirary other JS files (either vis node's `import` or via #include)
347+
if DEBUG or settings.BOOTSTRAPPING_STRUCT_INFO or config.FROZEN_CACHE or settings.JS_LIBRARIES:
344348
return compile_javascript()
345349

346350
content_hash = generate_js_compiler_input_hash()

0 commit comments

Comments
 (0)