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

**URL:** https://qa.fmod.com/t/how-to-load-fmodstudio-js-in-a-javascript-file-not-html/16075
**Category:** FMOD Engine
**Tags:** html5
**Created:** [August 12, 2020, 12:45pm UTC](https://qa.fmod.com/t/how-to-load-fmodstudio-js-in-a-javascript-file-not-html/16075 "2020-08-12T12:45:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![floodgames](https://avatars.discourse-cdn.com/v4/letter/f/7ea924/32.png) [@floodgames](https://qa.fmod.com/u/floodgames)
#### Post date: [August 12, 2020, 12:45pm UTC](https://qa.fmod.com/t/how-to-load-fmodstudio-js-in-a-javascript-file-not-html/16075/1 "2020-08-12T12:45:41Z")

</div>

`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:

> **[CSP: script-src](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src)**
>
> The HTTP Content-Security-Policy (CSP) script-src directive specifies valid sources for JavaScript. This includes not only URLs loaded directly into script elements, but also things like inline script event handlers (onclick) and XSLT stylesheets...

Thank you!

---

<div class="post-metadata">

### Author: ![joshua\_strawchildgam](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@joshua\_strawchildgam](https://qa.fmod.com/u/joshua_strawchildgam)
#### Post date: [August 14, 2020, 4:28am UTC](https://qa.fmod.com/t/how-to-load-fmodstudio-js-in-a-javascript-file-not-html/16075/2 "2020-08-14T04:28:13Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![floodgames](https://avatars.discourse-cdn.com/v4/letter/f/7ea924/32.png) [@floodgames](https://qa.fmod.com/u/floodgames)
#### Post date: [October 27, 2020, 7:01pm UTC](https://qa.fmod.com/t/how-to-load-fmodstudio-js-in-a-javascript-file-not-html/16075/3 "2020-10-27T19:01:00Z")

</div>

“fmodstudio.js [Report Only] Refused to compile or instantiate WebAssembly module because ‘wasm-eval’ is not an allowed source of script in the following Content Security Policy directive: “script-src ‘self’ ‘unsafe-eval’ ws:”.”

eval() is not allowed in the code.
