swc-compile function deepMerge didn't handle array type properly
powerfulyang opened this issue · comments
非凡少年 commented
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
If I delacre paths in .swcrc
and tsconfig.json
at the same time, the deepMerge function in https://github.com/nestjs/nest-cli/blob/1b9ab2641a2e46427bb5e54b5f0f6feda4a65276/lib/compiler/swc/swc-compiler.ts#L205C13-L205C13 will convert source code below:
{
"paths": [
"@/*": ["src/*"]
]
}
to
{
"paths": {
"@/*": {
"0": "src/*"
}
}
}
Due to the above issue, @swc/cli fails to start with an error 'invalid type: map, expected a sequence at line 1 column 560'.
Minimum reproduction code
https://github.com/powerfulyang/api.powerfulyang.com
Steps to reproduce
pnpm i
pnpm run build
Expected behavior
build successfully.
Package version
10.1.7
NestJS version
10.0.5
Node.js version
18.16.1
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
This BUG fisrt appear in [@nestjs/cli@10.0.4](feat: auto-populate tsc paths in swc config)
Kamil Mysliwiec commented
Let's track this here #2161