webcomponents / webcomponents.org

Home of the web components community
https://www.webcomponents.org
Apache License 2.0
356 stars 95 forks source link

[catalog-server] Element declarations in separate modules not found #1371

Closed justinfagnani closed 1 year ago

justinfagnani commented 1 year ago

Try @lion/button/lion-button-submit in a local dev environment: http://localhost:5450/catalog/element/@lion/button/lion-button-submit

This page errors because no declaration is found.

There are at least three problems here:

  1. The page should show more about the error
  2. No problems are recorded with the PackageVersion document
  3. The manifest appears correct. The custom element definition and declaration (the class) are in separate modules and we don't seem to resolve the reference to the declaration correctly.

We see the custom element export in the lion-button-submit.js module:

    {
      "kind": "javascript-module",
      "path": "lion-button-submit.js",
      "declarations": [],
      "exports": [
        {
          "kind": "custom-element-definition",
          "name": "lion-button-submit",
          "declaration": {
            "name": "LionButtonSubmit",
            "module": "/src/LionButtonSubmit.js"
          }
        }
      ]
    },

The module has no declarations because it just imports and registers an element:

import { LionButtonSubmit } from './src/LionButtonSubmit.js';

customElements.define('lion-button-submit', LionButtonSubmit);

The declaration is in the src/LionButtonSubmit.js file:

    {
      "kind": "javascript-module",
      "path": "src/LionButtonSubmit.js",
      "declarations": [
        {
          "kind": "class",
          "description": ...,
          "name": "LionButtonSubmit",