Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not resolve import "lit/decorators" #3397

Closed
AbandonedFridge opened this issue May 4, 2022 · 5 comments
Closed

Could not resolve import "lit/decorators" #3397

AbandonedFridge opened this issue May 4, 2022 · 5 comments
Labels
Type: Bug Something isn't working

Comments

@AbandonedFridge
Copy link

AbandonedFridge commented May 4, 2022

Describe the bug
Since 0.26.0, all packages are causing a Could not resolve import "lit/decorators"... error. This appears to stem from .js being removed from all imports.

To Reproduce
Update any @material/mwc-... component to 0.26.0

Expected behavior
Module should work

@christophe-g
Copy link
Contributor

Dup of #3395

@TownCube
Copy link

TownCube commented May 5, 2022

Using the lit recommended open-wc starter this is now broken,

npm init @open-wc --destinationPath /home/towncube/programs/main-app --type scaffold --scaffoldType app --features building --typescript true --tagName main-app --writeToDisk true --installDependencies npm

On start:

Error while transforming node_modules/@material/mwc-drawer/mwc-drawer.js: Could not resolve import "lit/decorators".

   7 | // Style preference for leading underscores.
   8 | // tslint:disable:strip-private-property-underscore
>  9 | import { customElement } from 'lit/decorators';
     |                               ^
  10 | import { DrawerBase } from './mwc-drawer-base';
  11 | import { styles } from './mwc-drawer.css';
  12 | let Drawer = class Drawer extends DrawerBase {

On build:

(!) Plugin node-resolve: Could not resolve import "lit/decorators" in /home/towncube/programs/main-app/node_modules/@material/mwc-drawer/mwc-drawer.js using exports defined in /home/towncube/programs/main-app/node_modules/lit/package.json.
(!) Plugin node-resolve: Could not resolve import "lit/directives/class-map" in /home/towncube/programs/main-app/node_modules/@material/mwc-drawer/mwc-drawer-base.js using exports defined in /home/towncube/programs/main-app/node_modules/lit/package.json.
(!) Plugin node-resolve: Could not resolve import "lit/decorators" in /home/towncube/programs/main-app/node_modules/@material/mwc-drawer/mwc-drawer-base.js using exports defined in /home/towncube/programs/main-app/node_modules/lit/package.json.
(!) Unresolved dependencies
https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
lit/decorators (imported by node_modules/@material/mwc-drawer/mwc-drawer.js, node_modules/@material/mwc-drawer/mwc-drawer-base.js)
lit/directives/class-map (imported by node_modules/@material/mwc-drawer/mwc-drawer-base.js)

@christophe-g
Copy link
Contributor

It also breaks using material components in lit playground

the console throws:

Uncaught TypeError: Failed to resolve module specifier "lit/decorators". Relative references must start with either "/", "./", or "../".

@asyncLiz
Copy link
Collaborator

asyncLiz commented May 5, 2022

Thanks for the reports all, we're looking into this 👍

@asyncLiz
Copy link
Collaborator

asyncLiz commented May 5, 2022

See #3395 for tracking

@asyncLiz asyncLiz closed this as completed May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants