Skip to content

Commit 6fcb996

Browse files
committed
safari: Change terser configuration to workaround threejs/terser incompatibility (#5495)
Users have reported problems loading TensorBoard in Safari: #5489 Thanks to @severo and @bileschi we were able to identify the problem to an incompatibility between threejs (which we use for WebGL rendering) and terser (which we use for minimizing/optimizing our code). Angular encountered this problem last year and worked around it by changing their terser config by reducing number of passes from 3 to 2: * angular/angular-cli#21107 * angular/angular-cli@2c2b499 In our case I have to reduce the number of terser passes from 3 to 1. For some reason reducing to 2 does not solve the problem. This change surprisingly appears to reduce binary size. Before this change the size of index.js is 7672844 bytes. After this change the size of index.js is 7670992 bytes -- reducing binary size by 1852 bytes.
1 parent 835fe3a commit 6fcb996

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

tensorboard/defs/defs.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ def tf_js_binary(
7777
terser_minified(
7878
name = internal_result_name,
7979
src = internal_rollup_name,
80+
# Notes about the terser config:
81+
# compress.passes - this is set to '1' to workaround issue with
82+
# terser and threejs. In practice it (surprisingly) generates
83+
# smaller results than when it was previously set to '3'.
8084
config_file = "//tensorboard/defs:terser_config.json",
8185
visibility = ["//visibility:private"],
8286
sourcemap = False,

tensorboard/defs/terser_config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
},
55
"compress": {
66
"keep_fnames": true,
7-
"passes": 3,
7+
"passes": 1,
88
"pure_getters": true,
99
"reduce_funcs": true,
1010
"reduce_vars": true,

0 commit comments

Comments
 (0)