Giter VIP home page Giter VIP logo

Comments (10)

justinfagnani avatar justinfagnani commented on August 11, 2024 1

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.

from lite-youtube-embed.

spacedawwwg avatar spacedawwwg commented on August 11, 2024

could this not be handled by babel if required?

from lite-youtube-embed.

XhmikosR avatar XhmikosR commented on August 11, 2024

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

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

from lite-youtube-embed.

paulirish avatar paulirish commented on August 11, 2024

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?

from lite-youtube-embed.

XhmikosR avatar XhmikosR commented on August 11, 2024

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 :)

from lite-youtube-embed.

XhmikosR avatar XhmikosR commented on August 11, 2024

Err, I meant https://github.com/amilajack/eslint-plugin-compat

from lite-youtube-embed.

XhmikosR avatar XhmikosR commented on August 11, 2024

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?

from lite-youtube-embed.

Garbee avatar Garbee commented on August 11, 2024

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?

from lite-youtube-embed.

XhmikosR avatar XhmikosR commented on August 11, 2024

I hadn't actually read the code :)

from lite-youtube-embed.

ahmadalfy avatar ahmadalfy commented on August 11, 2024

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

Welcome back @paulirish 😄

from lite-youtube-embed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.