fix: ignore import path transformations on win32 platform #570
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current version of the library throws me a bunch of errors, when trying to build my nest application with
transformer-plugin
enabled.In general, the plugin works fine when DTOs are simple enough. But in cases, when classes have complex properties represented by other classes defined elsewhere. In such cases, the application doesn't start as the plugin breaks all such imports
Errors state, that:
Which means, it replaces the short relative path (originally
import { ClientDto } from './client.dto';
) with a long absolute path starting with../
.Don't know, why you use
path.posix.relative
and not justpath.relative
, but however, for the best compatibility possible, I made the if statement to skip all these path transformations when running on a windows environment.Briefly tested on one of my projects, and this little change fixed me 75 errors, and none of the mappings broke.
P.S. The second commit was created only to pass the sonar verification. Didn't change it to the recommended '??' for backward compatibility, as I'm not ready to properly test the related functionality
P.S.S. @nartc appreciate if you check and merge it ASAP as I really like your package architecturally wise, but it's the only thing that blocks me from running some of my projects natively on my windows laptop.