"ReferenceError: require is not defined" on android

Hello everyone.
I’m newbie here to obsidian and javascript.
What I am trying to is importing my own functions into the view.js files so that dv.view can work properly.
I’m using ‘require’ and it work fine on PC, but when I switch to android it just not working and said
“ReferenceError: require is not defined.”

I found that years ago someone had this exact same problem but there was no conclusion.

Here is my code

After searching I found the CustomJS plugin and it work!!

But when looking into the code, I still can’t figure out the reason why I can’t use ‘require’ and how to fix my original code by myself (for learning javascript and obsidian purpose).
Somebody said that this may cause by differnet framwork between desktop and mobile, in other word Electron and Capacitor?

I’m confuse now so if anyone can explain this to me, I’d appreciate it!
Thank you!