webpack-contrib / file-loader

File Loader
MIT License
1.86k stars 255 forks source link

Pass additional assetInfo object when calling emitFile #382

Closed bschlenk closed 3 years ago

bschlenk commented 3 years ago

Feature Proposal

Webpack loader's emitFile call takes a 4th param that can provide additional info about an asset, like whether it is immutable or not. file-loader should pass in { immutable: true } when the file name includes [contenthash] so that other plugins can benefit from this info.

The new assetInfo param was added in https://github.com/webpack/webpack/issues/9038.

Feature Use Case

I'm writing a plugin that uses this info to determine what cache-control headers a file can be given.

alexander-akait commented 3 years ago

Let's do it

alexander-akait commented 3 years ago

Fixed by https://github.com/webpack-contrib/file-loader/pull/383