4.0.26 breaks ES5 bundle/older browsers
Closed this issue · 7 comments
950a0c8#diff-511cd8643d7d9406c6ee3da0f0688aad
The worker string contains newer features like const
and, problematically, arrow functions; these are not supported in Internet Explorer, so even though it’s ‘advertised’ as being ES5 compatible, it will cause a (hard to debug) syntax error in IE11, for example.
Hi @haggholm, sorry for the inconvenience. With the commit you referenced I was able to find the problem. I defined the supported browsers explicitly in order to get rid of the deprecated 'es2015' setting of Babel here: chrisguttandin/worker-timers-worker@05fa52a. The link points to the repository of the package which produces the worker string. This should have been a breaking change. Sorry for that. I know how painful it is to debug things in IE.
Are you able to pin the version to 4.0.25? That might be the easiest fix.
If you don't want to pin the version you can also construct the final 'worker-timers' yourself as this package is just a thin wrapper composed of two other packages. This would have the advantage of allowing you to chose the targeted ES version.
Can you please tell me where I wrote that this package supports ES5, so I can correct it?
Can you please tell me where I wrote that this package supports ES5, so I can correct it?
You didn’t—sorry, I should have been clearer: I put scare quotes around ‘advertised’ because I didn’t mean it literally, but rather that (it seems to me) having a bundle named build/es5/bundle.js
implies that it’s ES5 compatible.
Hi @haggholm, I agree that's indeed a bit confusing. The bundle itself is transpiled to es5 but the contained worker isn't. I have to revisit the packaging again. Or I should at least mention it somewhere.
I planned to provide a little example on how to use the worker manually but had not time to do it so far. Have you been successfull with transpiling the worker for your own needs?
For the time being, I just pinned the version to 4.0.25. It looked to me like the worker injection is done by manual copy-paste? I’d be more likely to use that if it were automated (or if I found the time to automate it my end). Though I didn’t spend much time on it, so maybe I just missed something.
Hi @haggholm, can you please give v4.0.49 a try. I updated the build process in a way that it transpiles the worker string inside of es5 bundle to es5 as well. Please let me know if it actually works.
Sorry for the late reply—and thank you.
Unfortunately, I don’t have my IE11 environment functional right now, so I would have trouble checking, but installing the latest worker-timers
, I notice that worker-timers-worker/build/es5/worker.min.js
still contains const
. On the other hand, it looks to me like the actual worker-timers
bundle uses an inline string rather than a URL, so maybe that doesn’t matter.
Thanks for checking. Yes, the old bundled and minified files are still there. I left them untouched for now. The new approach is to bundle the source code right before inlining the string.
I will close the issue now since I believe it's fixed. Please let me know if the issue is popping up again.