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

[vite]: Rollup failed to resolve import - Trying to use images that are in /public/images/image.png #12

Open
Junkboy1 opened this issue Jun 1, 2023 · 1 comment

Comments

@Junkboy1
Copy link

Junkboy1 commented Jun 1, 2023

Hello Im Trying to use images that are in /public/images/image.png I do the import as

import logoSrcDark from "/images/LogoOpthormDark.png";

Then I get this failure:

image

I tryed a lot.. even ./images ../images just /images or just /image.png etc..
Nothing works..

Same for scripts in root.tsx I set some <script> tags about google analytics and other .js for mailsform in php and everything doesnt work.

@ThuKieuIC2
Copy link

ThuKieuIC2 commented Aug 24, 2023

try with ~ for Vite to understand
import logoSrcDark from "~/images/LogoOpthormDark.png";

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

No branches or pull requests

2 participants