Skip to content

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

Closed

Description

@bkewl

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).

Activity

  1. nonara commented on Oct 24, 2022

    @nonara
    Collaborator

    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.

  2. changed the title [-][Bug] Nx Transformer "is not a Transformer Plugin", is missing "after"[/-] [+][Bug] Nx Transformer "is not a Transformer Plugin"[/+] on Oct 24, 2022
  3. bkewl commented on Oct 24, 2022

    @bkewl
    Author

    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?

  4. nonara commented on Oct 24, 2022

    @nonara
    Collaborator

    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!

  5. bkewl commented on Oct 24, 2022

    @bkewl
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions