Closed bkewl closed 1 year ago
Thanks for the report. Are you able to provide a reproduction repo?
Regarding the message: It does not provide neither before(), after(), nor afterDeclarations()
, this indicates that at least one of those properties is required. If none are present, it throws this error. That being said, we provide 2 of 3, which is all that we need, so you shouldn't be getting this error.
This seems to indicate an issue with the actual export. Sounds like an ESM vs. CJS issue.
We don't face either of the reported issues in our test setup. See: https://github.com/LeDDGroup/typescript-transform-paths/blob/master/test/projects/nx/packages/library1/project.json
My guess is this either has to do with your nx version or ESM woes. In any case, if you can provide a repro, I will be happy to take a look when I can!
Or if you'd like to dig into personally, I'd also welcome any insight you might find on what's going on.
Thanks for the quick reply!
You're right about the at least one requirement there. The grammar of the error message confused me.
We have created a repro-repo here: https://github.com/PatchOnKnee/fictional-winner
npx nx run test-lib:build
I cloned the typescript-transform-paths
repo and installed the local version ("typescript-transform-paths": "file:../../typescript-transform-paths"
in package.json
) and it worked fine. Makes be think it's something Nx is doing with it's local module resolution?
Seems it was a silly oversight on my part! The original work was done in a PR. I changed the entry file name but forgot to update it in the package.json
.
v3.4.4
should cover you. Thanks for the repro. Let me know if you face any other issues!
v3.4.4
works a charm. Thank you!
The Nx Transformer (https://github.com/LeDDGroup/typescript-transform-paths/commit/66191641bcd023464198b1974a6c351c831dc803) outputs
typescript-transform-paths/dist/plugins/nx-transformer-plugin is not a Transformer Plugin. It does not provide neither before(), after(), nor afterDeclarations()
, from https://github.com/nrwl/nx/blob/229f71ef1758ee625869aaa6fa6355dc3284fa5b/packages/js/src/utils/typescript/load-ts-transformers.ts#L56. Looks likeafter
is the missing function.Also, the README example for the plugin is missing a quote before "name". https://github.com/LeDDGroup/typescript-transform-paths/blob/master/README.md?plain=1#L85, and the export isn't correct because I get the additional warning
"typescript-transform-paths/nx-transformer" plugin could not be found!
(which is why you see I'm pointing todist/plugins/nx-transformer-plugin
above).