OpenChemistry / tomvizweb

Tomviz web code supporting the Tomviz desktop application for web export of data
https://openchemistry.github.io/tomvizweb/
BSD 3-Clause "New" or "Revised" License
1 stars 3 forks source link

Error: only one instance of babel-polyfill is allowed #4

Closed mrakitin closed 6 years ago

mrakitin commented 6 years ago

We together with @yxqd are trying to implement tomvizweb visualization in Jupyter notebooks (please see https://github.com/scikit-beam/ipywe). We met a problem when attempting to visualize two objects: image

Steps to reproduce:

I hope it can be fixed soon. We don't observe problems with vtk.js visualization of multiple objects in different cells (try http://localhost:8000/notebooks/tests/test_vtkjs.ipynb).

cryos commented 6 years ago

@jourdain do you have any ideas on what is wrong here?

jourdain commented 6 years ago

Yes, I've added the polyfill inside tomviz-web to make it work on "old" browsers.

But when inside the notebook, Jupyter already provide the polyfill, so by loading tomviz-web we load that library twice.

To fix it, we should remove it from tomviz-web. But when embedding in web pages that don't already load the polyfill, we should add the polyfill script along with the tomviz-web one.

jourdain commented 6 years ago

Remove that line

https://github.com/OpenChemistry/tomvizweb/blob/master/Source/tomviz-viewer.js#L7

Then when doing that https://openchemistry.github.io/tomvizweb/docs/ we should have both scripts

<script type="text/javascript" src="https://unpkg.com/babel-polyfill/dist/polyfill.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/tomvizweb"></script>
cryos commented 6 years ago

Thanks @jourdain for explaining, I will take a look and try to get something pushed when I get a chance.

cjh1 commented 6 years ago

@mrakitin Sorry for the delay, this issue is now resolved in the latest release of tomvizweb, see screenshot below. Thanks for the excellent instructions for the recreate.

screen

mrakitin commented 6 years ago

@cjh1, thank you for resolving the issue, this is a really useful fix!