Skip to content

Angular-Shepherd 19 CommonJS build fails with TS2309 #2610

Open

Description

@KeithGillette

Attempting to upgrade to Angular-Shepherd 19 in a project using moduleResolution: node generates the following error:

Error: node_modules/shepherd.js/dist/cjs/shepherd.d.cts:581:1 - error TS2309: An export assignment cannot be used in a module with other exported elements.

581 export = Shepherd;
    ~~~~~~~~~~~~~~~~~~

Activity

  1. RobbieTheWagner commented on Feb 4, 2025

    @RobbieTheWagner
    Member

    @KeithGillette would you be able to update to "moduleResolution": "bundler"? That's how I fixed things. I am unfamiliar with how Angular usually does things, so if node is required for all Angular projects we probably do need a different fix, but I find it strange that a browser framework would be using node.

  2. KeithGillette commented on Feb 4, 2025

    @KeithGillette
    Author

    Hi, @RobbieTheWagner — Since I opened this issue, I was able to update my Angular 19 project to "moduleResolution": "bundler" since a different dependency of our project corrected their package.json exports, which was previously preventing the update, so this is no longer actually a problem for me. However, I think there's an error in the CommonJS distributable in the published Angular-Shepherd 19 package, per the output I reported, as "moduleResolution": "node" worked fine with Angular-Shepherd 18. I see a couple of people reacted to my original post, so this may still be problematic for others.

  3. itmilos commented on Feb 4, 2025

    @itmilos

    I have the same issue...

  4. cdelgadob commented on Mar 9, 2025

    @cdelgadob

    Fully agree with @KeithGillette - while this setting solves the problem, it's just a workaround, and not a final solution, which should be considered in a future fix.

  5. RobbieTheWagner commented on Mar 12, 2025

    @RobbieTheWagner
    Member

    We're actually likely to drop CJS entirely soon and highly recommend that folks use "moduleResolution": "bundler"

  6. FloSojer commented on Apr 4, 2025

    @FloSojer

    Looking forward to the fix - thanks!

    Temporarily I could fix it the following way because I'm not able to set "moduleResolution": "bundler"

    Modify the file

    // node_modules/shepherd.js/dist/cjs/shepherd.d.cts
    // REMOVE or comment this line:
    // export = Shepherd;
    

    Run the command

    npx patch-package shepherd.js
    
  7. RobbieTheWagner commented on Apr 4, 2025

    @RobbieTheWagner
    Member

    Does Angular not support ESM?

  8. KeithGillette commented on Apr 4, 2025

    @KeithGillette
    Author

    Angular definitely supports ESM. The problem is that non-Angular legacy dependencies in projects can prevent upgrading to a moduleResolution that will actually use the Angular-Shepherd ESM distributable and instead try to use Angular-Shepherd's CJS modules, which are not correct, generating the error I reported. I was able to replace the other dependency in my project that was preventing switching moduleResolution, and so now am using the correctly formatting ESM Angular-Shepherd modules, but I think the other commenters on this thread have been unable to do so for their projects, leading to the request to correct the CJS distributable.

  9. RobbieTheWagner commented on Apr 5, 2025

    @RobbieTheWagner
    Member

    We are planning to ship ESM only soon, so I just wanted to understand.

  10. kav-viasat commented on May 12, 2025

    @kav-viasat

    any update on this?

  11. RobbieTheWagner commented on Jun 30, 2025

    @RobbieTheWagner
    Member

    any update on this?

    No. We are stuck trying to update Shepherd to Svelte 5. I highly recommend folks use "moduleResolution": "bundler"

  12. slifty commented on Jul 23, 2025

    @slifty

    Unfortunately we use a lot of dependencies that don't support ESM (this is the problem with ESM isn't it -- it splits the ecosystem!)

    Just wanted to offer a voice of "please continue to support common JS" since that would allow us to continue to use your great tool!

  13. RobbieTheWagner commented on Feb 10, 2026

    @RobbieTheWagner
    Member

    So we decided to move to vanilla TS instead of svelte, which I think should fix this. I will release a new version of angular-shepherd targeting the latest shepherd soon.

  14. kav-viasat commented on Feb 11, 2026

    @kav-viasat

    excellent could you please make sure Angular upto 21 is supported when you release the new version.

  15. PAX523 commented on Feb 13, 2026

    @PAX523

    You changed the license to AGPL with the new release, which makes this dependency unattractive

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions