We've created a react web client in typescript that uses lightstreamer. We wrote our own typings to cover the types we need from LS.
We have used the AMD module generated from the current downloads page. When using requirejs to import the module at runtime, there's no problem.
If we instead use create-react-app to scaffold an app then webpack does the bundling and therefore module importing at runtime. At runtime we get an error like the one in this github issue:
https://github.com/webpack/webpack/issues/5316
`Uncaught Error: define cannot be used indirect`
This appears to be caused by the problem mentioned in the comment
https://github.com/webpack/webpack/issues/5316#issuecomment-395778081
>I've found the issue. Problem is that define is redefined and shadows global.define. If you replace remove var in the source, then it works as expected. I'm not sure webpack can do anything about this.
>tl;dr: var define is hoisted and shadows global.define which breaks the build.
Rather than modify the lib to fix this issue and have the bundle work, we now treat LS as a global. This is also the case in the only LS typescript sample app I've seen. Treating LS as a global works, but is non-ideal
I would like to know whether you have a fix or workaround for this so that LS can be imported as a module.
And whether you have any upcoming releases that makes LS easier to use in a typescript context, like a web client npm package (although the package lightstreamer-client works in a web context it doesn't have some features) and @types package.
Cheers