Vitest's vi.stubEnv does't work? Let's fix it

I recently had an scenario where I wanted to test that a React component was only rendered in non-production environments. The setup looks like this:

const { PROD: isProduction } = import.meta.env;

export const DebugComponent = () => {
  
};