rollup/rollup

[dir] placeholder for `output.assetFileNames`

vveisard opened this issue · 3 comments

Feature Use Case

My use case is to preserve the path of output asset without hashing, so that I can reliably locate an asset using its original path.

Feature Proposal

My proposal is to implement the [dir] placeholder, (implemented in Bun's bundler: https://bun.sh/docs/bundler#naming) which resolves to the "relative path from the build root to the parent directory of the file".

This is related to #4724, because a plugin could be created which implements this requested feature.

need this feature

Would like have this feature. +1

The problem is that this information is just not available, see also #4724.
Assets are emitted by plugins using a name of their choosing. The question whether those assets correspond to a file on the disk and which file this is is currently not part of the asset emission API. So this problem cannot be fixed only on Rollup side, Rollup needs to extend its API and all plugins emitting assets need to follow suit. However, there was not yet a proposal how to extend the API that was implemented.