0

I'm trying to implement classMap from lit-html. When I install the package my application stops working saying the following: Package path ./directives/unsafe-svg is not exported from package.

This error originates from another web component I'm using which uses the same version of lit-element as I'm using: 2.4.0. I've been reading that using lit-element and lit-html can interfere due to version mismatch. I ran npm dedupe but that also didn't work.

Does anyone know how to fix this?

Ricardo de Vries
  • 113
  • 3
  • 11
  • It's hard to say without seeing the whole project but my guess is the web component where the error is happening was using an older version of `lit-html` and now needs to import the directive like `lit-html/directives/usafe-svg.js` with the extension included. See https://github.com/lit/lit/issues/1986 for why. – Augustine Kim Aug 22 '22 at 17:11

1 Answers1

0

import unsafe-svg.js i had the same problem with classMap.

import {classMap} from 'lit-html/directives/class-map.js';
  • For anyone using VSCode you can switch out how you auto-import directives, the preference is also available for typescript. https://www.youtube.com/watch?v=N7UCTViU1tI – robstarbuck Sep 29 '22 at 11:50