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

SSR: Image assets imports are not handled properly #1711

Closed
2 of 3 tasks
farewelltosarajevo opened this issue Jan 25, 2021 · 0 comments
Closed
2 of 3 tasks

SSR: Image assets imports are not handled properly #1711

farewelltosarajevo opened this issue Jan 25, 2021 · 0 comments

Comments

@farewelltosarajevo
Copy link

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)
  • If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.

Describe the bug

Assets imports such as images (in my case a PNG) are not handled correctly during the SSR build.

Example:

if we have something like:

<img src="./assets/logo.png" />

in a component, the entry-server.js will include something like:

var _imports_0 = "/logo.png";

which resolves to nothing. The import should be something like /assets/logo.<hash>.png.

Reproduction

To reproduce this, adding an image in the ssr playground and importing it in App.vue, should be enough to demonstrate the defect.

System Info

  • vite version: 2.0.0-beta.48
  • Operating System: macOS Big Sur
  • Node version: 14.6.0
  • Package manager (npm/yarn/pnpm) and version: npm
@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant