lit / lit-element

LEGACY REPO. This repository is for maintenance of the legacy LitElement library. The LitElement base class is now part of the Lit library, which is developed in the lit monorepo.
https://lit-element.polymer-project.org
BSD 3-Clause "New" or "Revised" License
4.49k stars 319 forks source link

jsdelivr/+esm: [object Object] #1197

Closed X7md closed 2 years ago

X7md commented 3 years ago

https://cdn.jsdelivr.net/npm/lit-element@2.5.1/lit-element/+esm rendering: [object Object]

image

but https://unpkg.com/lit-element@2.5.1/lit-element.js?module work fine?

image

my code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <date-hijri date="Sat May 15 2021 18:17:31 GMT+0300"></date-hijri>
<script src='https://cdn.jsdelivr.net/npm/moment@2.29.1/moment.min.js'>
</script>
  <script src='https://cdn.jsdelivr.net/npm/moment-hijri@2.1.2/moment-hijri.min.js'>
  </script>
<script type='module'>
import {html, LitElement} from 'https://unpkg.com/lit-element@2.5.1/lit-element.js?module';

export class DateHijri extends LitElement {

  static get properties() {
    return {
      date: {type: String}
    }
  }

  constructor() {
    super();
    this.date = moment();
  }

  render() {
    let date_hijri = moment(this.date).format('iYYYY/iM/iD');
    return html`${date_hijri}هـ`;
  }
}

customElements.define('date-hijri', DateHijri);
    </script>
</body>
</html>
graynorton commented 2 years ago

This issue applies to LitElement 2.x; the current version is now 3.x.

Please open a new issue if this is still occurring with the new version.