Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime failures during 'strict mode' #52

Open
psybuzz opened this issue Aug 5, 2020 · 0 comments
Open

Runtime failures during 'strict mode' #52

psybuzz opened this issue Aug 5, 2020 · 0 comments

Comments

@psybuzz
Copy link

psybuzz commented Aug 5, 2020

Running weblas in a browser's 'strict mode' will throw runtime errors.

Repro: see https://jsfiddle.net/u7by8azp/, created by pasting dist/weblas.js into a script with 'use strict' at the top.
Expected: no console errors in devtools
Actual:

Uncaught ReferenceError: p is not defined
    at new DownsampleCalculator

This makes it challenging to use weblas as an external dependency when building a project that bundles or concatenates it with other scripts that have strict mode enabled.

It seems that if we patch a couple instances in weblas code, adding var before variable declarations, this should work:
https://jsfiddle.net/cft3aqvu/

psybuzz added a commit to tensorflow/tensorboard that referenced this issue Aug 5, 2020
Projector depends on Weblas, a 3rd party dependency that throws runtime
errors when run in a browser's strict mode:
waylonflinn/weblas#52

To workaround the error, this changes our Rollup config to generate output
files in non-strict mode.  Manually checked that the standalone target now
works (errored with `p is not defined` before):

`blaze run tensorboard/plugins/projector/polymer3/vz_projector:standalone`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant