Is there a smaller version of gojs or how to load only necessary modules?

We have recently run webpack bundle analyzer and one of our largest packages is gojs.

Is there a way to minimize the size of the package?
Maybe by only loading the required modules and then let webpack tree shake the rest?

Any ideas would be appreciated.
Thanks

Have you read Building GoJS from Source -- Northwoods Software ?

So, If I understand correctly I need to include minimal-index.ts and then import gojs from it?

import { go } from './minimal-index';

Then add/remove the modules I use in my projects?

Modify the minimal-index.ts file to include those features you use.

You might want to compare with the projects/maximalSource code, to see how it’s different.

What is the standard package compiled with?
maximalSource ?

Yes, that is correct. Maybe it would be easier for you to start from maximalSource and remove those that you don’t need.

I see all modules are being imported from a directory called srcTS but I can’t find that directory in the gojs files nor in your official github repo.

What am I missing?

First you will need to acquire a source code license. But I should repeat what that page also says: that most programmers do not achieve significant space savings because they only do rudimentary operations such as tree-shaking. In fact I would guess that most developers end up increasing the size of the delivered code, despite the reduced functionality that is shipped, because they don’t use advanced techniques to minimize the code.

So, what you are basically saying is don’t even bother?

As stated above our largest package is gojs and it is not one of our main product pilars, although it is necessary for some internal features.
Is there an option to load gojs from a cdn or similar?

Only bother if you care enough to really minify well.

Yes there are several CDNs. Lately I have been using unpkg.com. For example, depending on what you want:
https://unpkg.com/gojs
https://unpkg.com/gojs@2.2
https://unpkg.com/gojs@2.2.18
https://unpkg.com/gojs/release/go-module.js
https://unpkg.com/gojs/release/go-debug.js