how to use require in browser? js / html

I searched whole stackoverflow to fix it, but cant. So… I need to use NPM module in browser (index.html).

Getting error “require is not defined” if using

<script src="./script.js"></script>

in html file, and using const { WebcastPushConnection } = require('tiktok-livestream-chat-connector'); in script.js.

Tried to use browserify, and when i use outputed js script getting error “require.resolve is not a function”

Can anyone help?