How to use STLExport outside of playground

Hi, I have some code that uses the STLExporter just fine in the playground. When I add the code to my application outside of the playground the STLExporter is undefined. How do I bring this in?

My app currently relies on CDN scripts - when I searched the babylonjs github I found that the STLExport may be in the serializers so I tried to import them with the script tag below.

<script src="https://preview.babylonjs.com/serializers/babylonjs.serializers.js"></script>

That led to this error:

Uncaught TypeError: Cannot read properties of undefined (reading ‘ShadersStore’)

What do I need to do to get STLExport outside of the playground?

Thanks.

https://doc.babylonjs.com/typedoc/classes/babylon.stlexport

Also, right now I’m using the function below instead of some CDN built in library. Thanks

Try <script src="https://cdn.babylonjs.com/serializers/babylonjs.serializers.min.js"></script> :smiley:

1 Like

That was it! Thank you for the help!

1 Like