Fix building with directory option when the baseUrl ends with '/'