ECMA Modules (import)
Enabling ECMA Module mode provides a way to break up your JavaScript code into multiple files. This is useful for organizing your code and for reusing code across multiple scripts.
ECMA Module mode is enabled by setting the javascript.ecma_module_mode property to true in the module where the script is being used.
To import a module, use the import statement. For example:
import {Foo} from 'scripts/my_module.mjs';
export function handle() {
const foo = new Foo();
return foo.square(42);
}
where my_module.mjs is a file in a subdirectory of the smilecdr root directory called "scripts". In this example my_module.mjs could contain something like the following:
export class Foo {
square(x) {
return x * x;
}
}
You are about to leave the Smile Digital Health documentation and navigate to the Open Source HAPI-FHIR Documentation.