Fixed stacktraces and source maps on the built exe (!153)

This PR fixes a long standing issue where stacktraces in the built executable didn't have line and column numbers, so you were left wondering where exactly in a given function an error occurred.

This also fixes source maps being generated but not actually included in the executable, this fix results in `source-map-support` actually doing it's job, so now stacktrace paths point to the typescript files, line and column number, instead of the transpiled javascript line and column number.

Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/153
Co-authored-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
Co-committed-by: TheSparta <thesparta@noreply.dev.sp-tarkov.com>
This commit is contained in:
TheSparta 2023-10-15 07:31:16 +00:00 committed by chomp
parent e327f8101a
commit 1ab7c5946e
8 changed files with 8 additions and 10 deletions

View File

@ -25,6 +25,6 @@
"lazy": false,
"noInterop": false
},
"sourceMaps":true,
"sourceMaps": true,
"minify": false
}

View File

@ -272,11 +272,9 @@ const build = (packagingType) =>
const packaging = async (entry) =>
{
const target = `${nodeVersion}-${process.platform}-${process.arch}`;
console.log("target", target);
const args = [entry, "--compress", "GZip", "--target", target, "--output", serverExe, "--config", pkgConfig];
try
{
await pkg.exec(args);
await pkg.exec([entry, "--compress", "GZip", "--target", target, "--output", serverExe, "--config", pkgConfig, "--public"]);
}
catch (error)
{

View File

@ -4,8 +4,8 @@
"obj/**/*.js"
],
"assets": [
"obj/**/*.d.ts",
"obj/**/*.js.map",
"package.json"
]
}
}
}

View File

@ -1,4 +1,5 @@
import "reflect-metadata";
import "source-map-support/register";
import { Program } from "../Program";
globalThis.G_DEBUG_CONFIGURATION = true;

View File

@ -1,4 +1,5 @@
import "reflect-metadata";
import "source-map-support/register";
import { Program } from "../Program";
globalThis.G_DEBUG_CONFIGURATION = true;

View File

@ -1,4 +1,5 @@
import "reflect-metadata";
import "source-map-support/register";
import { Program } from "../Program";
globalThis.G_DEBUG_CONFIGURATION = false;

View File

@ -1,4 +1,5 @@
import "reflect-metadata";
import "source-map-support/register";
import { Program } from "../Program";
globalThis.G_DEBUG_CONFIGURATION = true;

View File

@ -1,4 +1,3 @@
import sourcemapSupport from "source-map-support";
import { inject, injectable, injectAll } from "tsyringe";
import os from "node:os";
@ -26,9 +25,6 @@ export class App
public async load(): Promise<void>
{
// bind callbacks
sourcemapSupport.install();
// execute onLoad callbacks
this.logger.info(this.localisationService.getText("executing_startup_callbacks"));