Imported png images cannot be parsed locally (in development mode, run npm vite
). However, they did fix it in the production version. At first, I imported them dynamically, but they didn't resolve in the production version, so I imported them ahead of time.
1 2 |
|
1 2 3 4 5 6 7 |
|
test.png:1 GET http://localhost:3000/frontend/src/assets/frontend/src/assets/sprites/test.png 404 (Not Found)
P粉4941519412023-10-26 00:22:17
To resolve this issue, use new URL(url, import.meta.url) to resolve static resources in prod and dev
See the Vite documentation on static asset handling: https://vitejs.dev/guide/assets.html#new-url-url-import-meta-url
1 |
|