launchdarkly / electron-client-sdk

LaunchDarkly Client-side SDK for Electron
Other
4 stars 9 forks source link

Windows initializeInRenderer crashes because of assignment to const #15

Closed clemkoa closed 4 years ago

clemkoa commented 4 years ago

Describe the bug When calling initializeInRenderer from a renderer process in Windows, it always crashes because of the code here: https://github.com/launchdarkly/electron-client-sdk/blob/4cea9dbb9af48f11538d67ed5ad438342037f2ae/src/rendererClient.js#L56 The code in the filePathToUrl tries to assign a new value to the const pathName

To reproduce Call LDElectron.initializeInRenderer(); from a renderer process in Windows

Expected behavior It should not crash

Logs

TypeError: Assignment to constant variable.
    at filePathToUrl (webpack-internal:///./node_modules/launchdarkly-electron-client-sdk/src/rendererClient.js:56)
    at makeEventUrlTransformer (webpack-internal:///./node_modules/launchdarkly-electron-client-sdk/src/rendererClient.js:34)
    at Object.initializeInRenderer (webpack-internal:///./node_modules/launchdarkly-electron-client-sdk/src/rendererClient.js:20)
    at initializeLDClient (webpack-internal:///./src/boot/launchDarkly.ts:25)
    at EventEmitter.eval (webpack-internal:///./src/boot/launchDarkly.ts:20)
    at EventEmitter.emit (:8081/events.js:203)
    at Object.onMessage (:8081/electron/js2c/renderer_init.js:2394)

SDK version 1.4.1

Language version, developer tools NA

OS/platform Windows 10

Additional context Happy to provide more info if needed

eli-darkly commented 4 years ago

Yikes— sorry, and thanks for catching this. I'm surprised that this was not caught by the linter. We'll have a patch release out shortly.

eli-darkly commented 4 years ago

Fixed in the 1.4.3 release. We've also improved our linter settings. Thanks again.

clemkoa commented 4 years ago

No worries! Thanks for the quick response and release!