You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I was wondering if anyone has also seen a weird issue come up with nrwl NX framework + dnd-kit when building an application with production optimizations on or any production build optimizations for that matter?
Using rectIntersection function and with keyboard dragging I get this issue
"Cannot access 'a' before initialization"
Which when using the production optimization produces this
The problem goes away when using direct values of targetArea, entryArea and intersectionArea varibles into intersectionRatio instead of the actual variables defined.
Weird thing is you can also just insert another variable right before "const right" like so:
const top = Math.max(target.top, entry.offsetTop); const left = Math.max(target.left, entry.offsetLeft); const pikachu = Math.max(target.top, entry.offsetTop); const right = Math.min(target.left + target.width, entry.offsetLeft + entry.width) + pikachu - pikachu;
Inserted pikachu variable and have it cancel itself out so it doesn't get removed from the optimizations.
This produces const a = (o - r) * (l - n);
Figure I mention this in case someone ran into the same issue and needed a workaround or if someone experience something similar. Again this only happens once a production build distribution is built with NX and then served otherwise it never runs into this issue. Sorry for the wall of text!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi! I was wondering if anyone has also seen a weird issue come up with nrwl NX framework + dnd-kit when building an application with production optimizations on or any production build optimizations for that matter?
Using rectIntersection function and with keyboard dragging I get this issue
"Cannot access 'a' before initialization"
Which when using the production optimization produces this
const a = (a - r) * (o - n);
The main culprit was rectIntersection
The problem goes away when using direct values of targetArea, entryArea and intersectionArea varibles into intersectionRatio instead of the actual variables defined.
Weird thing is you can also just insert another variable right before "const right" like so:
const top = Math.max(target.top, entry.offsetTop); const left = Math.max(target.left, entry.offsetLeft); const pikachu = Math.max(target.top, entry.offsetTop); const right = Math.min(target.left + target.width, entry.offsetLeft + entry.width) + pikachu - pikachu;
Inserted pikachu variable and have it cancel itself out so it doesn't get removed from the optimizations.
This produces
const a = (o - r) * (l - n);
Figure I mention this in case someone ran into the same issue and needed a workaround or if someone experience something similar. Again this only happens once a production build distribution is built with NX and then served otherwise it never runs into this issue. Sorry for the wall of text!
Cheers!
Beta Was this translation helpful? Give feedback.
All reactions