olegbl / d2rmm

Mod Manager for Diablo II: Resurrected
https://www.nexusmods.com/diablo2resurrected/mods/169
MIT License
54 stars 9 forks source link

[TypeScript] loading imports from a subfolder is broken #20

Closed Caedendi closed 1 month ago

Caedendi commented 1 month ago

D2RMM 1.6.1.

Expected behaviour: loading imports uses the current file's path Actual behaviour: loading imports always looks at the mod folder path, even when the current file that is loading an import is in a subfolder.

Example: Say I have the following file/folder structure:

/mymod/mod.json
/mymod/mod.ts
/mymod/sub/file1.ts
/mymod/sub/file2.ts
/mymod/sub/file3.ts

mod.ts:

import { file1 } from "./sub/file1"; // works fine

file1.ts:

import { file2 } from "./sub/file2"; // VSCode says error, D2RMM works
import { file3 } from "./file3";     // VSCode says fine, D2RMM throws error

Error: Mod mymod encountered a compile error! Error: BridgeAPI.readModCode: Failed to read mods\mymod\file3.ts

olegbl commented 1 month ago

Thanks for the report! I'll patch this real quick while no existing TS D2RMM mods rely on the current behavior yet.