[jsscripting] Tell the script context to use the classloader of the current class. (#11400)

Fixes #11222

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
This commit is contained in:
Dan Cunningham 2021-10-19 07:21:06 -07:00 committed by GitHub
parent 6a33a3fd27
commit cb9b69943c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,6 +70,7 @@ public class OpenhabGraalJSScriptEngine extends InvocationInterceptingScriptEngi
.option("js.commonjs-require-cwd", MODULE_DIR).option("js.nashorn-compat", "true") // to ease
// migration
.option("js.commonjs-require", "true") // enable CommonJS module support
.hostClassLoader(getClass().getClassLoader())
.fileSystem(new DelegatingFileSystem(FileSystems.getDefault().provider()) {
@Override
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options,