chore: use relative imports with .ts #2694

Merged
Sainan merged 3 commits from relative-ts into main 2025-08-25 13:37:15 -07:00
2 changed files with 1 additions and 14 deletions
Showing only changes of commit 6dca1e7465 - Show all commits

View File

@ -4,7 +4,7 @@
"description": "WF Emulator",
"main": "index.ts",
"scripts": {
"start": "node --enable-source-maps --import ./build/src/pathman.js build/src/index.js",
"start": "node --enable-source-maps build/src/index.js",
"build": "tsgo --sourceMap && ncp static/webui build/static/webui",
"build:tsc": "tsc --incremental --sourceMap && ncp static/webui build/static/webui",
"build:dev": "tsgo --sourceMap",

View File

@ -1,13 +0,0 @@
// Hooks node to support require from "@/" paths for `npm run build && npm run start`.
// Based on https://github.com/dividab/tsconfig-paths
/* eslint-disable */
const Module = require("module");
const originalResolveFilename = Module._resolveFilename;
Module._resolveFilename = function (request: string, _parent: any): string {
if (request.substring(0, 2) == "@/") {
const modifiedArguments = [process.cwd() + "/build/" + request.substr(2), ...[].slice.call(arguments, 1)]; // Passes all arguments. Even those that is not specified above.
return originalResolveFilename.apply(this, modifiedArguments);
}
return originalResolveFilename.apply(this, arguments);
};