You can use JSR223 PreProcessor Choose Javascript language
Include your library using for example __FileToStringjsCode and put it in UserDefinedVariable:
jsCode / __FileToString(path to file)
In my example, file contains:
var s = "toto";
In you script:
${jsCode};
vars.put("toto", s);
Anyway I am not sure using Javascript is great for performances.
Groovy is a better option.