You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading a handful of projects to Greenwood v0.15.0, the SPA projects, which also happen to be on Lit@2 RC versions, started to experience this issue just when running greenwood develop. Running greenwood serve was fine.
Seems like a regression then if they were all working fine before? Should try and solve ASAP though along with keeping an eye on #675.
thescientist13
changed the title
Lit@2 and SPA is unable to to resolve LitElement import in development
Lit@2 and SPA is unable to to resolve LitElement import in development
Aug 6, 2021
thescientist13
changed the title
Lit@2 and SPA is unable to to resolve LitElement import in development
Lit@2 and SPA mode is unable to to resolve LitElement import in development
Aug 6, 2021
OK, found the issue and this is actually related to the refactoring for #520 and more of a coincidence than anything wrong with Lit2@ or SPA mode, per se.
What was happening was in the SPA repo, we had this file structure
src/
index.js
In index.js we would import Lit as usual
import{html,LitElement}from'lit';
But what I observed in the browser was that Greenwood was actually resolving node_modules/lit/index.js to src/index.js! 😱
What was happening was that in plugin-user-workspace, the resolveRelativeUrlmethod from ResourceInterface was chopping down the path such once it cutoff node_modules and lit, it would only leave index.js, which we of course have as a file in our src/ directory, and thus, a (undesired) "match".
So basically, easiest solution is to just make plugin-user-workspace ignore anything with node_modules in the URL since it doesn't need to care about anything but files in the user's workspace.
Should find a way to add a spec for this when opening the PR.
thescientist13
changed the title
Lit@2 and SPA mode is unable to to resolve LitElement import in development
node modules paths are being resolved to "matching" user workspace paths causing broken package loading
Aug 6, 2021
Type of Change
Summary
After upgrading a handful of projects to Greenwood v0.15.0, the SPA projects, which also happen to be on Lit@2 RC versions, started to experience this issue just when running
greenwood develop
. Runninggreenwood serve
was fine.Seems like a regression then if they were all working fine before? Should try and solve ASAP though along with keeping an eye on #675.
Details
Examples of the issue
Other projects, (those not using Lit@2 anyway), seem to be fine with the upgrade, so there's that going for us at least 😅
The text was updated successfully, but these errors were encountered: