question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bento: Consider shipping custom elements via npm

See original GitHub issue

Description

While a Bento React/Preact component can be consumed via npm, the custom element version can be loaded from the CDN. For npm, one will be locked to a specific version as per the package.json/package-lock.json file, whereas the CDN version is evergreen.

When not updating the npm packages frequently, the two versions will get out of sync quickly.

Example: I am building a WordPress plugin with a custom Gutenberg block with a carousel, using @ampproject/amp-base-carousel. If my users don’t update the plugin in a very long time, the React component I ship with the plugin will become super old, but the web component on the frontend is up-to-date. There could be visual disparity or other differences between the two, which could cause confusion and perhaps even bugs.

Another issue is that some users don’t want their components to be loaded from a CDN but instead want to load them from their own server.

For me as developer there’s currently no easy way to offer that, because the custom element is not shipped via npm. If it were, then I can just bundle it with my plugin together with the React component.

Alternatives Considered

Developers could manually download the JS&CSS from the CDN and put it in their code base and hope that it’s the same version as the one they got from npm.

Additional Context

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
estherkimcommented, Oct 25, 2021

Hi @swissspidy, web components via Option 1 are published on npm starting with v1.2110212130.0 - can you give it a try?

(Starting tomorrow, web-component.js will be the main script in package.json)

1reaction
samouricommented, Oct 5, 2021

Why not both?

No reason. We’ll implement both then 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bento - GitHub
Run Preact unit tests on build outputs for npm #35768 opened by caroqliu. Stale Inactive for one year or more. Type: Feature Request...
Read more >
@webcomponents/custom-elements - npm
Start using @webcomponents/custom-elements in your project by running `npm i @webcomponents/custom-elements`. There are 384 other projects ...
Read more >
Broadcast from a browser with the Amazon IVS web ... - AWS
Load the IVS web broadcast SDK. The library can be either installed via npm or loaded via <script> html tags. This post will...
Read more >
تويتر \ Web Components SF (WebComponentsSF@) - Twitter
Web Components SF hosts its first ever virtual meetup, featuring talks by Kristján Oddsson ... Start using @adobe/lit-mobx in your project by running...
Read more >
brightcove npm
Package Galaxy / Brightcove custom player using the Brightcove Player API. ... Tags python, brightcove, api Maintainers jbeluch Classifiers. js and NPM to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found