From a285cd3985686aa09b38bbcae9a58ee252f0991d Mon Sep 17 00:00:00 2001 From: Jesse Date: Tue, 14 Jan 2025 13:10:31 +0100 Subject: [PATCH] Mod fixes (#1080) Changes the following: - New targets, module and moduleResolution for mods - Enables `isolatedModules` as this matches the SPT server. - Includes user/mods in tsconfig.json to allow for mods to be loaded when a debugger is attached. --- project/src/services/ModCompilerService.ts | 7 ++++--- project/tsconfig.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/project/src/services/ModCompilerService.ts b/project/src/services/ModCompilerService.ts index 1d7b0f77..42c3fcb1 100644 --- a/project/src/services/ModCompilerService.ts +++ b/project/src/services/ModCompilerService.ts @@ -57,9 +57,9 @@ export class ModCompilerService { return this.compile(modTypeScriptFiles, { noEmitOnError: true, noImplicitAny: false, - target: ScriptTarget.ES2022, - module: ModuleKind.CommonJS, - moduleResolution: ModuleResolutionKind.Node10, + target: ScriptTarget.ESNext, + module: ModuleKind.Preserve, + moduleResolution: ModuleResolutionKind.NodeNext, sourceMap: true, resolveJsonModule: true, allowJs: true, @@ -67,6 +67,7 @@ export class ModCompilerService { downlevelIteration: true, experimentalDecorators: true, emitDecoratorMetadata: true, + isolatedModules: true, rootDir: modPath, }); } diff --git a/project/tsconfig.json b/project/tsconfig.json index dfef6933..84f84128 100644 --- a/project/tsconfig.json +++ b/project/tsconfig.json @@ -17,5 +17,5 @@ "@tests/*": ["./tests/*"] } }, - "include": ["src/*", "src/**/*"] + "include": ["src/*", "src/**/*", "./user/mods/**/*"] }