Make the crate a den with meals and toys, never a punishment space.

Leave the crate door open with soft bedding and toss treats inside. Feed meals near then inside the crate so it predicts good things.
Close the door briefly while you stay nearby, then build alone time slowly. Whining that fades is different from panic — adjust if your pet is frantic.
Never use the crate for punishment. A positive crate helps with travel, recovery after surgery, and house training.