I have fixed this by adding only nakama-js.umd.js to the assets folder and importing the script as plugin
nakama-js.umd.js
assets