New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
IE11 browser support #246
Comments
Thanks for brining this to my attention! I was un-aware that this didn't work for IE. Color2K ships with an ESM bundle and a UMD bundle and my current understanding it that your bundler is supposed to handle transpiling the ESM bundle down to IE 11 compatible JS. Can you provide more info on what bundler you're using and your babel settings? If you're using webpack, can you paste your webpack config? |
Hi, thanks for the quick response! The repo that directly depends on color2k is 5app/base5-ui, which doesn't use a bundler. The link will take you right to the In the (private) repository consuming base5-ui, we're working around the issue now by explicitly compiling module: {
rules: [
{
test: /.jsx?$/,
exclude: [
/node_modules\/(?!color2k)/,
],
use: {
loader: 'babel-loader'
}
}
]
}, I'm not that well-versed in bundling & build-tooling, so I wasn't able to use this approach directly in base5-ui, which uses Babel directly without a bundler.
Babel is usually, or at least by default, set up to ignore anything inside of However in this case it seems like the offending part of the code is small enough to be compiled by default without penalty. Feel free to let me know if you need any other info from me to assist with this. |
Ooof that one-off hurts me lol.
I do compile it down to the lowest common target for the UMD build (beeeg ugly bundle, compatible with your toaster and beyond) but for the ESM build I try to keep it relatively simple and modern. As a quick test, I booted up create-react-app and imported color2k to see how they handle it and from what what I'm seeing, they do compile this down. I don't know if that's the result of the bundler piping it through babel differently or the minifier removing the class though.
I tried this out in #247 and i'm not too sure if I like the result for other reasons besides bundle size. I'll have some time later this week to investigate but if you can find some articles/sources on best practices for ESM builds + how other pre-configured bundlers (e.g. create-react-app, next.js) work that would greatly help! |
@diondiondion any update on this? |
@ricokahler Sorry for not giving an update on this, I simply don't know enough about builds & bundlers to give you any qualified input on this. I asked some coworkers for input on this weeks ago, but they seemed to be happy to live with our color2k-specific workaround, so it seems like there really is not much you're doing wrong on your side. |
@diondiondion my apologies for closing. I actually stumbled upon this somewhat new video by google chrome developers about "transitioning to modern javascript". They mention that there's a new type of entry point field call I may switch to entirely if it makes sense. Here's the video with a timestamp. Very informational. I think I'll open an issue to try it out. Maybe this weekend. |
I just realised that color2k doesn't work in IE11 out of the box. 馃槶
It throws a syntax error when encountering the first line of this bit of code:
color2k/src/ColorError.ts
Lines 1 to 5 in f8f29d6
It would've been great if that was mentioned somewhere on the website or in the docs. I'm also wondering if this is the only incompatible part of the code, and if so, would you be happy to let Babel compile it for IE11? Not sure if that would cause a substantial increase in bundle size.
The text was updated successfully, but these errors were encountered: