Knex 'with' for relations do not found

I have this code:

const search = Business.query()
      .with('teamJoins', builder => {
        builder.whereIn('team_id', auth.user.teamsJoin)

        if (idTeam) {
          builder.where('team_id', idTeam)
        }
      })

If idTeam does exits, returns this data for teamJoins:
teamJoins: []

I need the answer not to return the relationship if it doesn’t exist