krpano.js error in strict-mode via webpack

  • Dear krpano Team,
    I tried to include the krpano.js via webpack, but it is throwing an error due to the automatically introduced strict-mode:
    "TypeError: Cannot set property length of [object Object] which has only a getter"

    Due to the heavy obfuscation of the js I don't wont to spend the time for reverse engeneering, but would love to see this fixed in one of the next versions of the file.

    Nowadays it is generally concidered good practise to have your code run in strict mode and it is supposed to also help performance:…oning-behind-it
    It would be also cool (but not nesessary), if the code could be wrapped a bit, so that it can be included using modern commonJs tools like webpack but still would work backwards compatible as standalone browser include:

    I'm happy to contribute a PR, but I guess you'll not want that ;)

    Best wishes

  • I know this is a really old thread, but was there ever a resolution to this? I'm hitting the exact same issue.

    Uncaught (in promise) TypeError: Cannot set property length of [object Object] which has only a getter    at krpano.js:219:1  at Object.embedpano (krpano.js:227:10) at gt (krpano.js:127:91) at yt (krpano.js:127:243) at d (krpano.js:168:1) at Object.embedpano (krpano.js:169:4)

    Using Typescript and Webpack.

  • Hi,

    due the 'dynamics' of the actions/object system using the strict mode is not possible. Some very important Javascript features are otherwise not available. That's intentional and not a bug and will not change.

    Generally strict mode should be always applied only to your own code and functions, never to third party stuff.

    Best regards,

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!