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

npm prefix imports externalized in vite. #40

Open
itsjamie opened this issue Feb 1, 2025 · 1 comment
Open

npm prefix imports externalized in vite. #40

itsjamie opened this issue Feb 1, 2025 · 1 comment
Labels
needs info Needs more information to be able to resolve the issue

Comments

@itsjamie
Copy link

itsjamie commented Feb 1, 2025

Adding the following to vite.config.js resolves the issue.

resolve: {
    alias: {
      "npm:lucide-react": "lucide-react",
      "npm:react": "react",
      "npm:marked": "marked",
    },
  },

using the following plugins

  • import react from "@vitejs/plugin-react"; - "@vitejs/plugin-react": "^4.3.4",
  • import deno from "@deno/vite-plugin" - "@deno/vite-plugin": "^1.0.3",

Without it, the following occurs:

Module "npm:react" has been externalized for browser compatibility. Cannot access "npm:react.memo" in client code.  See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Module "npm:lucide-react" has been externalized for browser compatibility. Cannot access "npm:lucide-react.HelpCircle" in client code.  See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
Module "npm:marked" has been externalized for browser compatibility. Cannot access "npm:marked.marked" in client code.  See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
@marvinhagemeister
Copy link
Collaborator

Tried a couple of scenarios, but I'm not able to reproduce the issue. Can you provide a github repo where the problem can be reproduced?

@marvinhagemeister marvinhagemeister added the needs info Needs more information to be able to resolve the issue label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info Needs more information to be able to resolve the issue
Projects
None yet
Development

No branches or pull requests

2 participants