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

Q: Error with Lazy Loading Components in Plasmo's Shadow UI #1024

Open
2 tasks done
tony-dominic opened this issue Jul 15, 2024 · 1 comment
Open
2 tasks done

Q: Error with Lazy Loading Components in Plasmo's Shadow UI #1024

tony-dominic opened this issue Jul 15, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@tony-dominic
Copy link

What is the example you wish to see?

Hi there!

I'm experiencing an issue when trying to implement lazy loading for components using React.lazy within Plasmo's Shadow UI.

Is there any context that might help us understand?

Specifically, I'm unable to access my lazily imported route, and I keep encountering the following error:

  1. I set up a lazy-loaded component (House) within my Home component like this:
import React, { lazy, Suspense } from 'react';
const House = lazy(() => import('./House'));

function Home() {
  return (
    <div>
      <h3>Home</h3>
      <Suspense fallback={<div>Loading...</div>}>
        <House />
      </Suspense>
    </div>
  );
}
  1. I'm using createMemoryRouter for routing.

Expected Behavior:

I expect the House component to load lazily without encountering the module resolution error.

Actual Behavior:

Instead, I receive the error mentioned above, suggesting that the dynamic import is not resolving correctly.

Additional Context:

I have confirmed that the path to House is correct.
I have tested static imports, which work fine, so the issue seems specific to lazy loading.

Questions:

Are there any known limitations or considerations regarding lazy loading components in Plasmo's Shadow UI?
What steps can I take to troubleshoot or resolve this issue?

Thank you for your help!

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.
@tony-dominic tony-dominic added the documentation Improvements or additions to documentation label Jul 15, 2024
@tony-dominic tony-dominic changed the title [EXP] Q: Error with Lazy Loading Components in Plasmo's Shadow UI Jul 15, 2024
@mouricef
Copy link

mouricef commented Aug 26, 2024

Facing same issue while importing plasmo storage dynamically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants