I am trying to import Svelte component from path which is set in string variable.
When I import the component using directly, it is working:
import("./Component.svelte").then(module => { Component2 = module.default;}).catch(error => {});
But, when I try to define a variable with the path of component and import it, it doesn't:
let filePath = "./Component.svelte"import(filePath).then(module => { Component2 = module.default;}).catch(error => {});
Is there anyway that I can import component with variable source path?
Here is the REPL