Importing JavaScript Library in Script Task

In a Camunda Platform Run-scenario I want to use a function from an external JavaScript-Library in a Script Task like so (inline script):

import { myFunc } from './myfancylibrary.mjs';
myFunc();

The library is deployed in Camunda on startup.

When the Script Task is reached, I get an error:

org.graalvm.polyglot.PolyglotException: SyntaxError: :1:0 Expected an operand but found import

Does anyone know how to solve this problem?

This block is considered modern javascript and will not work with the script editor.

import { myFunc } from './myfancylibrary.mjs';

Under Script Type did you consider using “External Resource”?