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

Make it ES5 compliant #7

Closed
XhmikosR opened this issue Nov 16, 2019 · 10 comments
Closed

Make it ES5 compliant #7

XhmikosR opened this issue Nov 16, 2019 · 10 comments

Comments

@XhmikosR
Copy link

No description provided.

@spacedawwwg
Copy link
Contributor

could this not be handled by babel if required?

@XhmikosR
Copy link
Author

It could, yeah, but we shouldn't make things more complex :)

I mean, if we can do without babel, it'd be better.

@paulirish
Copy link
Owner

it's been a while since i've published web-facing JS... are there any tools I can use to validate my npm package is es5-compliant?

@XhmikosR
Copy link
Author

There was an ESLint plugin, but I didn't have the best experience when I used it a long time ago. So maybe now it's been improved https://www.npmjs.com/package/stylelint-no-unsupported-browser-features

That being said, since the code isn't much, I can help if you need me. The .browserslistrc approach is the safest one, though, so that we have autoprefixer also if needed later. Although, from a quick look, the CSS is quite simple, so maybe only the JS part needs some love :)

@XhmikosR
Copy link
Author

@XhmikosR
Copy link
Author

Actually, scratch that. I don't think ES5 is needed https://caniuse.com/#feat=custom-elementsv1, right?

In that case, maybe there should be some feature checking?

@justinfagnani
Copy link

I would not publish custom elements as ES5. Since custom elements extend HTMLElement and must do a proper super() constructor call, they can't actually easily be compiled to ES5 class patterns. If you do, you'll need to include something like the custom-elements-es5-adapter from the web components polyfills, which can slow down all custom elements on the page.

It's much better to let consumers compile to old JS if they need to for their browser support requirements.

@Garbee
Copy link
Contributor

Garbee commented Nov 20, 2019

Yea, ES6 is required to properly publish Web Components. Distributing something older hinders the integration and performance.

Why did you initially request ES5 compatibility? What was the driving context that deemed ES5 a necessity?

@XhmikosR
Copy link
Author

I hadn't actually read the code :)

@ahmadalfy
Copy link

it's been a while since i've published web-facing JS

Welcome back @paulirish 😄

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

No branches or pull requests

6 participants