You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose I have two files with same name in folder A and A/B.
A/a.scss
A/B/a.scss
If I pass these two files directly as input, total four files are generated, a.123c4.js, a.df343.css, a.35353.js, and a.dfsdf.css.
Suppose I created a custom plugin, then in generateBundle menthod,
The bundle is an object with fileName key and either an asset or chunk object as value.
An asset object structure looks like this
Looking at this structure, suppose I am looking at an asset with a fileName 'assets/a.df343.css' and name : 'a.css'. How do I know from which of the two files a.123c4.js and a.35353.js the css file is related to?
Suggested solution
It would be awesome if there is a field like filePath: 'A/B/a.scss' in the asset structure in generateBundle method so that I can at least know this asset came from this file. Currently, there is only name field, which would only show 'a.scss', and I have no idea which of A/a.scss or B/a.scss it came from
Might be somewhat relevant to #2375 (comment). It would appear that for CSS/SCSS/Less Vite isn't exposing the orginal src path for anything that compiles to CSS?
This isn't really something Vite can apply. generateBundle is a Rollup hook and assets are emitted via the standard this.emitFile method. So unless Rollup exposes the filePath option, it isn't something Vite can do so. With that said, it'll be helpful to justify what your usecase is and perhaps it can be solved in a different way. But I'm closing this as it should be a Rollup feature request.
Clear and concise description of the problem
Suppose I have two files with same name in folder A and A/B.
A/a.scss
A/B/a.scss
If I pass these two files directly as input, total four files are generated, a.123c4.js, a.df343.css, a.35353.js, and a.dfsdf.css.


Suppose I created a custom plugin, then in generateBundle menthod,
The bundle is an object with fileName key and either an asset or chunk object as value.
An asset object structure looks like this
Looking at this structure, suppose I am looking at an asset with a fileName 'assets/a.df343.css' and name : 'a.css'. How do I know from which of the two files a.123c4.js and a.35353.js the css file is related to?
Suggested solution
It would be awesome if there is a field like filePath: 'A/B/a.scss' in the asset structure in generateBundle method so that I can at least know this asset came from this file. Currently, there is only name field, which would only show 'a.scss', and I have no idea which of A/a.scss or B/a.scss it came from
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: