Closed nmsobri closed 2 years ago
@slier81 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;
};
@raouldeheer Running tsc && tsc-alias -r debugger.js
give me: ( i need to exclude -w flag cause i need to see the error )
tsc-alias error: Failed to import replacer "debugger.js"
Here is my project structure:
.
├── debugger.js
├── package-lock.json
├── package.json
├── src
│ ├── app.ts
│ ├── controller
│ │ └── home.ts
│ ├── middleware
│ ├── model
│ │ └── home.ts
│ ├── route
│ │ └── v1
│ │ └── route.ts
│ ├── server.ts
│ └── service
│ └── home.ts
└── tsconfig.json
@raouldeheer so whats the update on this?
@tkcto I haven't been able to reproduce this bug. That makes it exceedingly difficult to give a time estimate.
@raouldeheer ah ic.. to add some context, when using w
flag, tsc-alias
no longer translate path alias ( and does not add .js
extension )
btw, i developed in vscode remote devcontainer, is there something related to it?
@raouldeheer i have setup demo repo for you with reproducible bug https://github.com/slier81/tscalias-bug-demo
@slier81 I've tried running the dev:compile
script, but it doesn't seem to start tsc-alias.
Changed the dev:compile
script from:
tsc -w & tsc-alias -w
To:
concurrently \"tsc -w\" \"tsc-alias -w\"
After doing that it worked and replaced aliases.
Can you try this? This could fix the issue.
Replacing the dev:compile
script to this would also solve the issue.
"dev:tsc": "tsc -w",
"dev:tsc-alias": "tsc-alias -w",
@raouldeheer
@slier81 I've tried running the
dev:compile
script, but it doesn't seem to start tsc-alias. Changed thedev:compile
script from:tsc -w & tsc-alias -w
To:
concurrently \"tsc -w\" \"tsc-alias -w\"
After doing that it worked and replaced aliases.
Can you try this? This could fix the issue.
Replacing the
dev:compile
script to this would also solve the issue."dev:tsc": "tsc -w", "dev:tsc-alias": "tsc-alias -w",
Yes this fix the issue.. But the second solution apparently only work, if there is already generated output. But according to your documentation
"build:watch": "tsc -w & tsc-alias -w"
should work.. Why runningtsc -w & tsc-alias -w
dont work? Maybe you need to update your documentation? thx anyway for the fix.. Greatly appreciated
I have to mention this, actually solution number 1 concurrently \"tsc -w\" \"tsc-alias -w\"
, actually also not working if this is the first time you running this command ( meaning, there is no generated output yet ).. On subsequent running of this command, it will work.. Quick fix would be tsc && (concurrently \"tsc -w\" \"tsc-alias -w\")
@nmsobri
Thank you! I faced the same exact problem and the tsc && (concurrently \"tsc -w\" \"tsc-alias -w\")
helped!
@raouldeheer, could you please put it in the docs? Because it's pretty confusing on the first interaction with the library to not be able to work with it in the watch mode :sweat_smile:
As title, When using
resolveFullPaths
in watch mode, the transpiled file doesnt have.js
extension It work just fine without watch modetsconfig.json
And run
tsc -w & tsc-alias -w
causing the transpiled file lost its extension