It is my understanding that a JS file should be put into /assets/js/file.js, because this way it can get minified and fingerprinted (https://gohugo.io/hugo-pipes/minification/).
I did so, my file is in /asses/js/file.js.
I’m using it in a partial like this:
Is there a value for the assetsDir parameter in your config?
OR
Are you using Hugo modules and have mounted a directory other than the default /assets/?
If you were able to use resources.Get "/static/img/klaro.js" it seems that you have set static/img as the assetsDir because the method resourses.Get only works for files under the assetsDir.
If the above does not help, you need to share your project for us to see the full context.