How to load fmodstudio.js in a Javascript file (not .html)

fmodstudio.js:1 Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' ws:".

This error originates by loading fmod in the .html file (or does fmodstudio api contain an eval() function?)

Currently I load fmodstudio in an .html via
<script type="text/javascript" src="/static/audio/fmodstudio.js" importance="low"></script>

how can it be loaded in a .js file like this:
import { FMOD } from "../fmodstudio.js"

Explanation on CSP here:

Thank you!

1 Like

If you are using node, just put it into a custom node module and npm install it. Then import it and viola. You’ll need to make very minor changes to the base fmodstudio.js, but it’s not anything huge really. (Or you can just make sure the additional file is included in the /public/static/js/ folder)