Open x87 opened 2 years ago
SDK command path allows CLEO\ prefix to be resolved as a path to CLEO directory. In imports there is no such logic, it resolves relative to current working directory (game root):
addon.js
import 'CLEO/MegaMod/extra/model.mjs'; // does not work if CLEO folder is not in root
DynamicLibrary.Load('CLEO/MegaMod/extra/lib.dll'); // works
Added a note in SDK docs https://re.cleo.li/docs/en/using-sdk.html#path-resolution-convention
The workaround for SDK commands is to use __dirname
for file path
DynamicLibrary.Load(__dirname + "\mylib.dll");
complex scripts could be organized in folders and subfolders. For example
import statements allows usage of
./
as the current file's directory. It resolves toCLEO/MegaMod/extra/
inaddon.js
and toCLEO/MegaMod/
inindex.js
.SDK commands allows
./
too. But it always resolves to theindex.js
directory, regardless of the file location.addon.js