Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Nx Transformer "is not a Transformer Plugin" #166

Closed
bkewl opened this issue Oct 23, 2022 · 4 comments
Closed

[Bug] Nx Transformer "is not a Transformer Plugin" #166

bkewl opened this issue Oct 23, 2022 · 4 comments
Labels
Bug Something isn't working

Comments

@bkewl
Copy link

bkewl commented Oct 23, 2022

The Nx Transformer (6619164) 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 like after 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 to dist/plugins/nx-transformer-plugin above).

@nonara
Copy link
Collaborator

nonara commented Oct 24, 2022

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.

@nonara nonara changed the title [Bug] Nx Transformer "is not a Transformer Plugin", is missing "after" [Bug] Nx Transformer "is not a Transformer Plugin" Oct 24, 2022
@bkewl
Copy link
Author

bkewl commented Oct 24, 2022

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?

@nonara nonara closed this as completed in 4396e0c Oct 24, 2022
@nonara
Copy link
Collaborator

nonara commented Oct 24, 2022

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!

@nonara nonara added Bug Something isn't working and removed Needs Reproduction labels Oct 24, 2022
@bkewl
Copy link
Author

bkewl commented Oct 24, 2022

v3.4.4 works a charm. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants