webcomponents.org icon indicating copy to clipboard operation
webcomponents.org copied to clipboard

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

Open justinfagnani opened this issue 1 year ago • 0 comments

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",

justinfagnani avatar Oct 18 '22 05:10 justinfagnani