Unable to build apk

When I run

npm run build-cordova-android

It gives me the following error.

X:\ila\build\build-cordova.js:13
const hash = entry.split('index.')[1].split('.js')[0];   
TypeError: Cannot read properties of undefined (reading 'split')
type or paste code here

I have the same issue with my first project.
Everything is fine for local development but it fails when I try to compile to APK.
Did you find a solution ?

OK, in my case it was because I added

    assetsInclude: ['**/*.html']

In my vite.config.js
Removing it, cordova-build is successful.