Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.1.0 breaks IE 11 #82

Closed
davidspiess opened this issue Apr 6, 2020 · 9 comments
Closed

3.1.0 breaks IE 11 #82

davidspiess opened this issue Apr 6, 2020 · 9 comments
Labels

Comments

@davidspiess
Copy link

The 3.1.0 update breaks IE 11 with: "Const must be initialized error"
I think the main culprit is the use of const in for of loops, which is not supported in IE11
https://github.com/blakeembrey/free-style/blob/master/src/index.ts#L257

Any chance to see this fixed?

@blakeembrey
Copy link
Owner

This is more likely the entire 3.1.0 build: https://github.com/blakeembrey/free-style/releases/tag/v3.1.0. Let me see what I can do so we have both benefits.

@blakeembrey blakeembrey added the bug label Apr 6, 2020
@blakeembrey
Copy link
Owner

So support IE11 changes the package from 1.64 KB to 1.96 KB, which isn't really an acceptable tradeoff in this case. I believe most of this weight comes from classes being down leveled, which probably isn't supported by IE11 either.

@blakeembrey
Copy link
Owner

@davidspiess Have you considered something like https://developer.epages.com/blog/coding/how-to-transpile-node-modules-with-babel-and-webpack-in-a-monorepo/? How are you dealing with other dependencies?

@blakeembrey
Copy link
Owner

Another alternative I've found is that I could distribute an ES5 version of the package and reference to it via package.json, and you could change Webpack to find it automatically (documentation here: https://webpack.js.org/configuration/resolve/#resolvemainfields). Unfortunately this wouldn't be automatic and would require some configuration.

@davidspiess
Copy link
Author

davidspiess commented Apr 7, 2020

This is more likely the entire 3.1.0 build

Ah, yes, i was only concerned by the error message, but probably you are right. There will be much more not working anymore.

How are you dealing with other dependencies?

It comes down to each dependency. Like you said, there are packages with a dedicated ES5 version (like https://react-hook-form.com/faqs#BrowserSupport), others suggest to install a specific ES5 compatible version (like https://github.com/sindresorhus/query-string).
Right now i only use TypeScript, Webpack and necessary Polyfills to create my bundle.

"compilerOptions": {
  "module": "esnext",
  "moduleResolution": "node",
  "target": "es5",
  "lib": ["es6", "dom"],
  ....
}

@blakeembrey
Copy link
Owner

The React Hook Form example is informative, thanks! Would you mind if this package does that as well?

@davidspiess
Copy link
Author

This would be greatly appreciated! Thanks! 😊

@blakeembrey
Copy link
Owner

I've published a patch with the ES5 version available from free-style/dist.es5, let me know if that works! I also updated the legacy browser note in the README to reflect this. For typestyle, I'll leave the ES5 implementation up to them, but you may need to update your Webpack configuration to find the new dist.es5 over the regular dist directory.

@davidspiess
Copy link
Author

Thank you for your quick support and effort 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants