Skip to content

Export for directives can't be resolved  #10

Closed
@knuthaug

Description

@knuthaug

We are experiencing an issue with using @popeindustries/lit@1.0.4 as a "proxy" for exports from @popeindustries/lit-html.

import { unsafeHTML } from '@popeindustries/lit/directives/unsafe-html.js';

gives the error

error TS2305: Module '"@popeindustries/lit/directives/unsafe-html"' has no exported member 'unsafeHTML'.

Checking the file node_modules/@popeindustries/lit/directives/unsafe-html.js it contains

export * from '@popeindustries/lit-html/directives/unsafe-html.js';

This file path points to nothing in the package @popeindustries/lit-html on disc in node_modules. @popeindustries/lit-html has src and vendor directories (and src/vendor) which contains directives. The export map of @popeindustries/lit-html lists directives as

"./directives/*": {
      "development": "./src/vendor/directives/*",
      "default": "./vendor/directives/*"
  }

which seem to point to the right place. So why can't the typescript compiler resolve this import? Using the import directly from lit-html gives the same error, while pointing directly to e.g. the vendor directory

import { unsafeHTML } from '@popeindustries/lit-html/vendor/directives/unsafe-html.js';

works as intended. This leads me to think that our project can't read/understand the exports map correctly, but shouldn't node 18.9 and typescript 4.8.3 be able to do that? On closer inspection it seems that it might be the wildcard export map that isn't understood, because addition of e.g

"./directives/async-append.js": {
      "development": "./src/vendor/directives/async-append.js",
      "default": "./vendor/directives/async-append.js"
    }

Seems to work well.

node version: 18.9.0
typescript version: 4.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions