0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:50:43 -05:00

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: SPT-AKI/Server#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, "lazy": false,
"noInterop": false "noInterop": false
}, },
"sourceMaps":true, "sourceMaps": true,
"minify": false "minify": false
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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