I am wondering if it has ever been considered to enable tree-shaking on dynamic imports. As a starter: If (and only if) every import of a module is easily statically analyzable, the same dead code elimination routines as they are used for static imports could be run.
If it is not easily analyzable, Parcel could always fall back to the current behavior. The resulting bundle sizes should remain same size or get smaller!.
With pure ESM this should be possible. We'd need to move the analysis of used imports to the bundling phase instead of the packaging phase though. It currently happens here. cc @mischnic I think you were running into something related today.