obsidian-modules icon indicating copy to clipboard operation
obsidian-modules copied to clipboard

TypeScript import other modules don't work

Open mnaoumov opened this issue 6 months ago • 2 comments

Considering issue #7 fixed with my PR #8

!Scripts/test.ts

export function sayHello(name: string) {
  console.log(`hello ${name}`);
}

!Scripts/test2.ts

import { sayHello } from "./test";

export function sayHello2(name: string) {
  sayHello(name + name);
}

and invoke from the Developer Tools console

const test2 = await self.require.import("!Scripts/test2.ts");

getting error

plugin:modules:30507 Uncaught Error: ./test
    at L (plugin:modules:30506:3402)
    at Object.assign (plugin:modules:30506:4548)
    at eval (plugin:modules:30506:10230)
    at L (plugin:modules:30496:49899)
    at index.ts:1:1

It seems it couldn't find the relative path module

mnaoumov avatar Jan 05 '24 20:01 mnaoumov