ES6 Tree Shaking and BABYLON.Tools

Hi!
I’m quite new in this forum, have only been lurking so far, but now I have a question:

I have been using the ES6 tree shaking as described here with great success. This reduced my package size from over 3Mb down to just over 1Mb.

Now I wanted to add Screenshot functionality using BABYLON.Tools.CreateScreenshot(). However, I haven’t found a way to include the tools other than importing like this:

import { Tools } from "@babylonjs/core";

Doing this seems to again completely import all of the Babylon core, putting my package size back to >3Mb.

Am I missing something, or is there really no way to import the CreateScreenshot function without importing the whole Babylon core?

Thanks in advance!

See ES6 - Babylon.js Documentation, it seems you need to import from misc/screenshotTools.

3 Likes

Thanks so much, Evgeni. Works like a charm.