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

running vite.ssrLoadModule causes error when using ESM CDN for example (esm.sh) #15143

Closed
7 tasks done
omridevk opened this issue Nov 26, 2023 · 2 comments · Fixed by #15599
Closed
7 tasks done

running vite.ssrLoadModule causes error when using ESM CDN for example (esm.sh) #15143

omridevk opened this issue Nov 26, 2023 · 2 comments · Fixed by #15599
Labels
enhancement New feature or request feat: ssr

Comments

@omridevk
Copy link

omridevk commented Nov 26, 2023

Describe the bug

I am trying to implement loading components from an ESM CDN, this works fine in the browser, but when trying to do SSR and calling ssrLoadModule, I am getting the following error:

6:02:47 PM [vite] Error when evaluating SSR module /src/pages/customer-page.tsx: failed to import "https://esm.sh/[email protected]"

Reproduction

https://stackblitz.com/edit/github-ad1c93-e4uuvj?file=package.json

Run npm run test to see the error.

Steps to reproduce

No response

System Info

System:
    OS: macOS 13.6.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 969.17 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.2.0 - ~/.nvm/versions/node/v21.2.0/bin/node
    npm: 10.2.3 - ~/.nvm/versions/node/v21.2.0/bin/npm
    pnpm: 8.2.0 - ~/Library/pnpm/pnpm
  Browsers:
    Brave Browser: 115.1.56.20
    Chrome: 119.0.6045.159
    Chrome Canary: 121.0.6149.0
    Safari: 17.1
  npmPackages:
    @vitejs/plugin-react: ^4.0.2 => 4.2.0
    vite: ^4.1.4 => 4.5.0

Used Package Manager

npm

Logs

No response

Validations

Copy link

Hello @omridevk. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

@omridevk
Copy link
Author

@sapphi-red
Added a reproduction stackblitz:
https://stackblitz.com/edit/github-ad1c93-e4uuvj?file=package.json

Run "npm run test"
to see the error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request feat: ssr
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants