Closed thetayloredman closed 2 years ago
@thetayloredman 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
[logn@logn ProtoBot]$ npx tsc-alias -r debugger.js
tsc-alias error: Failed to import replacer "debugger.js"
tsc-alias info: 0 files were affected!
[logn@logn ProtoBot]$ tsc-alias -r ./debugger.js
tsc-alias error: Failed to import replacer "./debugger.js"
tsc-alias info: 0 files were affected!
same without ./
Can you give us a file tree of your project directory? For example using the tree
command
$ tree -I 'node_modules' -I 'logs' -I 'data'
.
├── clean.sh
├── CODE_OF_CONDUCT.md
├── commitlint.config.js
├── CONTRIBUTING.md
├── debugger.js
├── ecosystem.config.js
├── install.sh
├── LICENCE
├── package.json
├── package-lock.json
├── README.md
├── src
│ ├── commands
│ │ ├── admin.ts
│ │ ├── boop.ts
│ │ ├── cat.ts
│ │ ├── cuties.ts
│ │ ├── dog.ts
│ │ ├── fox.ts
│ │ ├── fursona.ts
│ │ ├── help.ts
│ │ ├── hug.ts
│ │ ├── info.ts
│ │ ├── koala.ts
│ │ ├── meme.ts
│ │ ├── owos.ts
│ │ ├── pat.ts
│ │ ├── source.ts
│ │ ├── tildes.ts
│ │ ├── uwuify.ts
│ │ └── uwus.ts
│ ├── config.rename-me.ts
│ ├── config.ts
│ ├── header.ts
│ ├── hooks
│ │ ├── owos.ts
│ │ ├── tildes.ts
│ │ └── uwus.ts
│ ├── index.ts
│ ├── lib
│ │ ├── Client.ts
│ │ ├── CommandHandler.ts
│ │ ├── EnmapVerbose.ts
│ │ ├── interfaces
│ │ │ ├── commands
│ │ │ │ ├── CommandCategory.ts
│ │ │ │ ├── CommandConfig.ts
│ │ │ │ └── Command.ts
│ │ │ ├── Config.ts
│ │ │ ├── db
│ │ │ │ ├── Cooldowns.ts
│ │ │ │ ├── Fursona.ts
│ │ │ │ ├── UserConfig.ts
│ │ │ │ └── UserStats.ts
│ │ │ ├── Hook.ts
│ │ │ ├── Logger.ts
│ │ │ └── PublicConfig.ts
│ │ ├── memstat.ts
│ │ ├── onready
│ │ │ ├── index.ts
│ │ │ ├── init.ts
│ │ │ ├── loadhooks.ts
│ │ │ ├── restart.ts
│ │ │ └── status.ts
│ │ ├── types
│ │ │ └── Augments.d.ts
│ │ └── utils
│ │ └── doesHavePrefix.ts
│ ├── log.ts
│ └── publicConfig.ts
├── start.sh
├── templatecmd.ts
├── templateHook.ts
├── tsconfig.eslint.json
└── tsconfig.json
11 directories, 66 files
@thetayloredman In the tsconfig.json the outDir is set to "./dist/". Try using "./dist"?
@raouldeheer That fixed it... oversight in tsc-alias?
Yes this bug will be fixed in the next patch
Yes this bug will be fixed in the next patch
I've tried applying patch locally, but it doesn't really help when outDir has subfolder
it worked fine before though
in my case path is:
"outDir": "dist/server"
I've tried:
"outDir": "./dist/server",
"outDir": "./dist/server/",
"outDir": "dist/server/",
None worked
still broken on MacOS:
System:
OS: macOS 12.3.1
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 4.16 GB / 32.00 GB
Shell: 5.8 - /bin/zsh
Debugger gist: https://gist.github.com/wight554/98dbf3e7d713366824ec28a58240fd98
@wight554 the problem is that the @server
alias resolves to dist/server/server
because the outDir is dist/server
. But dist/server/server
doesn't exist so the aliases aren't resolved.
These are the files tsc-alias found:
dist/
server/
getViteServer.js
server.js
app/
AppModule.js
auth/
AuthController.js
AuthService.js
AuthModule.js
guards/
JwtAuthGuard.js
LocalAuthGuard.js
strategies/
JwtStrategy.js
LocalStrategy.js
comment/
CommentController.js
CommentModule.js
CommentService.js
dto/
CreateCommentDto.js
UpdateCommentDto.js
schemas/
CommentSchema.js
crypto/
CryptoModule.js
CryptoService.js
decorators/
UserDecorator.js
interceptors/
MongooseClassSerializerInterceptor.js
post/
PostController.js
PostModule.js
PostService.js
dto/
CreatePostDto.js
UpdatePostDto.js
schemas/
PostSchema.js
user/
UserController.js
UserModule.js
UserService.js
dto/
CreateUserDto.js
UpdateUserDto.js
schemas/
UserSchema.js
utils/
prettyPrintAddress.js
@wight554 the problem is that the
@server
alias resolves todist/server/server
because the outDir isdist/server
. Butdist/server/server
doesn't exist so the aliases aren't resolved.These are the files tsc-alias found:
dist/ server/ getViteServer.js server.js app/ AppModule.js auth/ AuthController.js AuthService.js AuthModule.js guards/ JwtAuthGuard.js LocalAuthGuard.js strategies/ JwtStrategy.js LocalStrategy.js comment/ CommentController.js CommentModule.js CommentService.js dto/ CreateCommentDto.js UpdateCommentDto.js schemas/ CommentSchema.js crypto/ CryptoModule.js CryptoService.js decorators/ UserDecorator.js interceptors/ MongooseClassSerializerInterceptor.js post/ PostController.js PostModule.js PostService.js dto/ CreatePostDto.js UpdatePostDto.js schemas/ PostSchema.js user/ UserController.js UserModule.js UserService.js dto/ CreateUserDto.js UpdateUserDto.js schemas/ UserSchema.js utils/ prettyPrintAddress.js
The project structure is
src/
server/
test/
With alias @src @server @test
I build only server folder with tsc, so I set include: ['server'] and build to dist/server
I use server alias in server folder
If I set outDir to ./dist, it'll build server folder containts to ./dist and will look for nested server folder like this:
./server/utils/
while it should look like this: ./utils
It worked fine before 1.6.5
Project is here: https://github.com/wight554/blog-template
@wight554 Changing the build:server
script from tsc-alias -p tsconfig.server.json
to tsc-alias --dir dist
fixes the issue.
I was having the same issue with tsc-alias info: 0 files were affected!
but when I added --dir dist
to tsc-alias
it fixed it 👍🏼
tsconfig:
script:
used
tsc-alias
and it works:used
build
script and it failsvia npx also affects 0:
Environment issue? my fault?