Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.
/ swc-decorator-fix Public archive

A hook that fixes swc with class-transformer

License

Notifications You must be signed in to change notification settings

sylodev/swc-decorator-fix

Repository files navigation

@sylo-digital/swc-decorator-fix

swc has some funky issues when it comes to decorators. This aims to fix them by falling back to tsc for any files that have decorators in them. This should fix this issue and a couple others I ran into until thy're fixed in swc. There is also persistent caching based on the hash of the file contents that speeds this process up considerably, so the performance impact of doing this should be minimal.

You can enable debug mode by setting NODE_DEBUG to swc-decorator-fix, this will log a lot of unnecessary info but will help see what it's actually doing behind the scenes and what files are cached.

usage

  • pnpm add @sylo-digital/swc-decorator-fix -D
  • node -r @sylo-digital/swc-decorator-fix -r @swc/register src/index.ts

This script must be loaded before @swc/register

About

A hook that fixes swc with class-transformer

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages