Closed czabaj closed 4 years ago
Sorry, it is out of scope file-loader
, you can create an own loader for this case, it is very non standard feature, you even can do it without loader, just fetch resource and calculate it, you already have URL to an asset,
Feature Proposal
Provide file stats as named exports, similarly how @swgr/webpack operates.
I found sizeof-loader which provides this functionality but has incompatible API with file-loader, it provides stats object including
src
as the default export, using named exports for stats would be backward compatible and possibly allows to use optimization (collect only stats user requests via named import).Feature Use Case
I want to display a human-readable file size as part of a hyperlink text, which points to a PDF file. I import the PDF file to obtain its pathname via file-loader, but there is not an easy way to obtain its size.