Use file src path as keys in build manifest
See original GitHub issue- Read the docs.
- Use Vite >=2.0. (1.x is no longer supported)
Describe the bug
Assets directories are not respected when generating a final build.
If your root is app/vite
,
and your entrypoint file is app/vite/entrypoints/application.js
And in your entrypoint you import import "../images/nested/image.svg"
Your production build still keeps the image in the top level assets
directory and doesnt transform it into: assets/images/nested/image[hash].svg
Instead, it just stays as assets/image[hash].svg
Reproduction
Here’s the repo with the reproduction:
https://github.com/ParamagicDev/vite_rb/tree/69ec263155317924fec47485fc09d4b391768bc8
the app in question is in the examples/rails-without-webpack
Directory.
to reproduce:
bundle install && yarn install && rails vite:build
this will then produce the final build files in the public/dist
directory.
Additional info
I previously solved this when I made a Snowpack plugin for Rollup bundling and was curious if something similar would work here as well:
https://github.com/ParamagicDev/snowpack-plugin-rollup-bundle
System Info
vite
version: ^2.0.0-beta.21- Operating System: MacOS Big Sur (M1)
- Ruby version: 2.7.2
- Node version: 14
- Package manager (npm/yarn/pnpm) and version: yarn 1.22
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (8 by maintainers)
Top GitHub Comments
This is a known issue - there’s actually a dedupe built-in here, but obviously the ideal format is using source paths relative to root as keys in the manifest - but that would technically be a breaking change which is why I haven’t done that yet.
@leepowelldev yes, original extensions are preserved.