Import and export all except few exports from an npm package

I am trying to export all exports from packageA and trying to create another packageB

For example

I am creating a new package (packageB) similar to Material UI. So to start with I have modified the Switch and Grid component of MUI. But my packageB should have all imports from MUI except Switch and Grid which I customized.

This is what I tried but did not work.

import * as muiAllExports from '@mui/material';
const { Switch, Grid, ...rest} = muiAllExports;

export { rest };

Is there a way to do it?