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

[Bug?]: Static Asset Imports Do Not Work With SSR #1182

Closed
2 tasks done
dairyisscary opened this issue Dec 26, 2023 · 3 comments
Closed
2 tasks done

[Bug?]: Static Asset Imports Do Not Work With SSR #1182

dairyisscary opened this issue Dec 26, 2023 · 3 comments
Labels
bug Something isn't working vinxi related to vinxi

Comments

@dairyisscary
Copy link

dairyisscary commented Dec 26, 2023

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Hi Ryan, Nikhil, and everyone else who's been putting in the amazing work into solid start (and the web at large haha)! 👋

When importing static assets, for example, import Img from "~/test.png";, the default export of this appears to be incorrect when server rendering this string, resulting in a 404 for the browser.

Example server output:

<!--!$e0-0-0-0-0-0--><img data-hk="0-0-0-0-0-0-0" src="/src/test.png" alt="hello world"><!--!$/e0-0-0-0-0-0-->

Client side rendering (with { start: { ssr: false } }) appears to get this src attribute correct with a /_build/@fs prefixed url that does not 404. I didn't try client side navigation within an SSRed app, but my suspicion is that it works since the client bundles are probably working the same in that case.

Also note that using hand-crafted, "public" urls from the vite /public directory appears to be work in both modes, unsurprisingly.

Expected behavior 🤔

Both server and client bundles should have same default export strings.

Steps to reproduce 🕹

Minimal reproduction (this is my app.jsx file in a "bare" start setup) and { start: { ssr: true } } in vite.config.js

// @refresh reload
import img from "~/test.png";

export default function App() {
  return <img src={img} alt="hello world" />;
}

Context 🔦

No response

Your environment 🌎

"@solidjs/start": "^0.4.2",
"solid-js": "^1.8.7",
"vinxi": "0.0.54"
@dairyisscary dairyisscary added the bug Something isn't working label Dec 26, 2023
@Christopher2K
Copy link

Experiencing the same thing using latest SolidStart!

@nksaraf nksaraf added the vinxi related to vinxi label Dec 27, 2023
@nksaraf
Copy link
Member

nksaraf commented Dec 27, 2023

Thanks for the report! Will take a look. Probably a bug in vinxi

@nksaraf
Copy link
Member

nksaraf commented Dec 27, 2023

Should be fixed in vinxi@0.0.55. please try that and reopen this issue if it still doesn't work.

@nksaraf nksaraf closed this as completed Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vinxi related to vinxi
Projects
None yet
Development

No branches or pull requests

3 participants