-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Spotlight Code is bundled twice in Astro Dev mode #68
Comments
let's see if we can keep this closed |
nope... |
OK So I think I figured out the cause: We bundle two versions of Spotlight code in different places and dispatch to the "wrong" event target
I think we have two solutions:
I think, given the limitations of 1, I'm gonna go with 2. Oh btw I have no idea about why this didn't cause problems within the monorepo. My best guess is that Vite and pnpm resolve and bundle dependencies differently than when a package is added as a dependency. This gives me trust issues in our monorepo 😅 |
So, this has all to do with how and where we import spotlight from.
Not sure if we can get around this easily... |
I don't think double-bundling is something that should happen. I could see this as perhaps being a race-condition where both modules are loaded in parallel resulting in them being double-loaded. What I'd try first is listing these packages in Vite's Doing this will cause Vite to pre-bundle them, in which case it should see that there is common dependencies between them and prevent the duplication. If that doesn't work, let me know and I'll think of something else. How you would do that in an Astro integration is with updateConfig |
@matthewp thanks for looking into this! I gave it a quick shot and Any further ideas? Fwiw, I pushed a workaround in #121 which also resolves the problem but it doesn't fix the double bundling. |
Gonna remove from the 1.0 milestone because it's unlikely that we fix this properly before 1.0. Also edited the title to be more precise. |
@Lms24 how can I tell if this is still an issue or not after the general Vite plugin approach? |
I guess we'd need to remove putting the spotlight event target (see However, given the age of this issue, if things work fine for now (with the global even target), I suggest we close this and reopen/open if we get reports. wdyt? |
No description provided.
The text was updated successfully, but these errors were encountered: