more details on .swcrc configuration module.lazy property? #7306
Unanswered
StefanZivkovic
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
@swc/core
:1.3.52
@swc/jest
:0.2.26
I am testing
@swc
with jest tests, instead ofts-jest
. While passing withts-jest
, some tests fail with@swc/jest
.I noticed that .swcrc module property values
"lazy": true
and"lazy": false
produce different output in some cases."lazy": true
One of the failures is
TypeError: Reflect.getMetadata is not a function
.The issue is with decorator usage
@Type(()=>Number)
.I have multiple classes having this usage, but it fails on only few places, and not on all class with same/similar usage of
@Type
decorator - it is something which bothers / confuses me.I do not have
import 'reflect-metadata';
anywhere in my code base."lazy": false
This time, previous error
Reflect.getMetadata is not a function
disappears, while reported issue isReferenceError: Cannot access 'Product' before initialization
. And while this is because of circular dependencies between two entities, it is fine with details how to work-around it in #5047.Questions / Concerns:
What value is way to go for
lazy
property in.swcrc
configuration? Or maybe better question is: which value should be avoided in most of the cases? Or it depends?What is best combination to stick with -
"lazy": false
and use typeormRelation
work-around circular dependencies?.swcrc
Beta Was this translation helpful? Give feedback.
All reactions