The Nimiq Web Client ships with support for CommonJS.
And now you are ready to go!
const Nimiq = require('@nimiq/core')
async function main() {
const config = new Nimiq.ClientConfiguration()
const client = await Nimiq.Client.create(config.build())
}
main()