-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Feature Use Case
Taken from #2415 (comment)
Many packages include hints in their package.json files if executing the module without any imports does have any side-effects. Having this information could have a serious positive effect of bundle size while improving bundling performance. As rollup itself does not read package.json files, rollup would need to provide a way for plugins to provide that information.
Feature Proposal
My suggestion is to extend the resolveId hook to have the following form:
type ResolveIdReturnValue = string | false | null | undefined | {id: string | false, sideEffects boolean}
resolveId: (importee: string, importer: string) => ResolveIdReturnValue | Promise<ResolveIdReturnValue>In case sideEffects: false is provided as additional information, rollup would not include any code from the module unless exports from this module are included. Not sure how easily this could be implemented internally.
Reactions are currently unavailable