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
{{ message }}
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.
Provide file stats as named exports, similarly how @swgr/webpack operates.
import termsAndConditions, { fileSizeHumanReadable, fileSizeBytes } from './termsAndConditions.pdf'
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: