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

Asset path broken for some assets #80

Closed
sigma-andex opened this issue Feb 13, 2024 · 8 comments
Closed

Asset path broken for some assets #80

sigma-andex opened this issue Feb 13, 2024 · 8 comments

Comments

@sigma-andex
Copy link

I'm trying to deploy a remix app (2.6.0) to vercel, but for some reason the assets are deployed to /build/vercel/path0/_assets/ and /build/_assets/. Unfortunately though, some of the assets (some pngs, but not all) are only deployed to /build/vercel/path0/_assets/ and therefore not found on my website. I have no idea why this happens and why it is only some of the pngs but not all. I have them in /app/assets but also tried /public and next to the importing tsx file.

@EndangeredMassa
Copy link
Collaborator

@sigma-andex can you share an example of this happening? IT could be your current project or a trimmed down version that reproduces the issue?

@lifeiscontent
Copy link

lifeiscontent commented Mar 7, 2024

I'm seeing something similar, I'm importing files from the root index path, and a few other pages under /platforms/example I'm seeing /platforms being prepended to the asset url path on the /platforms/example page

an example image path looks like: /app/assets/homepage/example.png

usage is as follows:

import imageUrl from '~/assets/homepage/example.png`

export default function Route() {
  return <img src={imageUrl} />
}

on the platform page the resolved url looks something like: /platforms/assets/homepage/example.png

I'm using the new vercelPreset for remix + vite

@lifeiscontent
Copy link

CC: @TooTallNate

@TooTallNate
Copy link
Member

@lifeiscontent I can not reproduce. Can you share your repository?

@lifeiscontent
Copy link

@TooTallNate yep, I'll put something together in the next hour or so. Thanks!

@lifeiscontent
Copy link

@TooTallNate here you go: lifeiscontent/remix-vercel-deploy-issue#1 let me know if you need any more context, I'm also available via discord at lifeiscontent if you'd like to chat further. Thanks again!

@lifeiscontent
Copy link

lifeiscontent commented Mar 7, 2024

@TooTallNate I actually ended up figuring this out, I guess with vite, url handling is a little bit different, if I add a / to the beginning of _vercel/image? path things work again. That being said, any chance you guys will be adding support for #65 or at the very least do you have any recommendations on the code I've provided in that PR to better utilize Vercel's image optimization service in a more DX friendly way?

@TooTallNate
Copy link
Member

Ok cool, sounds like this one can be closed then.

That being said, any chance you guys will be adding support for #65 or at the very least do you have any recommendations on the code I've provided in that PR to better utilize Vercel's image optimization service in a more DX friendly way?

Yes, I would like to add support for this. Follow the original issue for updates.

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

4 participants