swc-node
swc-node copied to clipboard
typescript metadata work error(nestjs)
.swcrc
{
"jsc": {
"loose": true,
"target": "es2020",
"parser": {
"syntax": "typescript",
"decorators": true
},
"transform": {
"legacyDecorator": true,
"decoratorMetadata": true
}
},
"module": {
"type": "commonjs",
"strict": true,
"strictMode": true,
"lazy": true,
"noInterop": true
}
}
error

Could you provide a minimal code snippet to reproduce this issue?
@Brooooooklyn My code
@Delete()
@SerializeOptions({ groups: ['category-list'] })
async destroyMulti(
@Query()
{ page, limit }: QueryCategoryDto,
@Body()
{ trash, categories }: DeleteCategoryMultiDto,
) {
return this.categoryService.deletePaginate(
categories,
{
page,
limit,
},
{},
trash,
);
}
and
if running by @swc/register every thing is work fine
const runner = nodemon({
script: 'src/main.ts',
ext: 'js,json,ts',
watch: ['src'],
ignore: ['.git', 'node_modules', 'dist', 'scripts'],
execMap: {
ts: 'node -r @swc/register -r module-alias/register',
},
env: {
NODE_ENV: environment(),
},
cwd: path.resolve(__dirname, '..', '..'),
spawn: true,
});
runner.once('start', () => {
console.log();
console.log('Server has started:');
if (urls.length > 0) {
console.log(`- Local: ${chalk.green.underline(urls[0])}`);
}
if (urls.length > 1) {
console.log(`- Network: ${chalk.green.underline(urls[1])}`);
}
});
runner.on('restart', () => {
console.log();
console.log(chalk.yellow('Server is in restarting...'));
});
but when change to @swc-node/register,will get this error
execMap: {
ts: 'node -r @swc-node/register -r module-alias/register',
},

I think the reason that is @swc-node/register not read the config file .swcrc,
{
"sourceMaps": false,
"jsc": {
"loose": true,
"parser": {
"syntax": "typescript",
"decorators": true
},
"transform": {
"legacyDecorator": true,
"decoratorMetadata": true
},
"target": "es2020",
"externalHelpers": false
},
"module": {
"type": "commonjs"
}
}
how to read it for this project @swc-node?