score:2

i did one workaround which seems to work so i am posting it here. instead of implementing scrollmagic at the beginning of the document, i implement it later after componentdidmount is called and after i can be 100% sure that the window object exists.

here you go:

componentdidmount = () => {
        if (typeof window !== 'undefined') {
            import('scrollmagic').then((scrollmagic) => {
                 // your scrollmagic code here
                 let controller = new scrollmagic.controller();
                 // ....
            });
        }
    }

this way the error disappears and therefore step 2 (step 2 from question) is not needed.


Related Query

More Query from same tag