Closed SebTVisage closed 2 years ago
@SebTVisage can you provide us the console output when running with -r debugger.js? Working version and nonworking version? debugger.js file placed next to tsconfig.json. With the debugger.js file contents being:
const util = require('util');
let loggedConfig = true;
exports.default = ({ orig, file, config }) => {
if (loggedConfig) {
console.log(util.inspect(config, {showHidden: false, depth: null, colors: true}));
loggedConfig = false;
}
console.log(orig);
console.log(file);
return orig;
};
@SebTVisage Can you try changing:
"@some/package/*": ["node_modules/@some/package/dist/*"]
into:
"@some/package/*": ["../node_modules/@some/package/dist/*"]
Ok this fixes tsc-alias
indeed, but I cannot use this config because it actually breaks tsc
. It fails to interpret the alias correctly.
I had to run tsc with my current config, then run tsc-alias with the change you proposed to make this work.
As a workaround, I'm using a specific tsconfig file for tsc-alias extending my actual one & overriding the alias. This unblocks me so thanks very much for your quick help. But do you think you can publish a fix for this?
@raouldeheer actually I have another blocking issue. With your fix, tsc replaces const util = require('util');
to const util = require('../util');
so it breaks at runtime.
This happens in the middlewares/request-logger.js
file.
EDIT: I think this came from the fact that this file was requiring node's util
module + requiring ../util/hrtimer
(my own file). I renamed my util
folder to utils
and it worked
@raouldeheer actually I have another blocking issue. With your fix, tsc replaces
const util = require('util');
toconst util = require('../util');
so it breaks at runtime.This happens in the
middlewares/request-logger.js
file.Output with -r debugger: EDIT: I think this came from the fact that this file was requiring node's
util
module + requiring../util/hrtimer
(my own file). I renamed myutil
folder toutils
and it worked
@SebTVisage Please read this article to better understand the behavior obtained but it is not a bug
Hi. So I had a project where everything was in the root, mix of TS & JS files.
So basically in my tsconfig I had set
"outDir": "."
. Then when running tsc then tsc-alias, everything worked fineNow I've just added a src/dist structure, put all code under the src folder and changed my tsconfig like so:
The only other notable change is that now I have
checkJs
&allowJs
set totrue
but I don't think this impacts tsc-alias.And for some reason now, tsc-alias does not replace any path anymore.
I use the
verbose
option. When it was working I had like 70+ files changed in tsc-alias output. Now I have 2, but when looking in the dist folder, nothing is replaced.Any idea what's going on?