fix: better ES module support for App class#2632
Conversation
|
Hey @malewis5! 👋 Thanks for sending this in and sharing such interesting tooling! I'm a fan of this contribution in improvements for #2565 but I am not familiar of the strangeness the current release has? Testing with the following doesn't cause errors for me: import { App } from "@slack/bolt";
const app = new App({ token: "example" });
await app.start();But please do let me know how else I can test this! FWIW this "esModuleInterop" option is suspicious to me and removing it might require more upstream changes 👁️🗨️ |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2632 +/- ##
=======================================
Coverage 93.37% 93.37%
=======================================
Files 37 37
Lines 7581 7581
Branches 667 667
=======================================
Hits 7079 7079
Misses 497 497
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Here are two example repos that wrap Bolt with a framework: |
zimeg
left a comment
There was a problem hiding this comment.
@malewis5 Thank you for sharing those steps and more examples! 👾 ✨
I'm finding this change to be so helpful in similar setups of slack-samples/bolt-js-starter-template#119 while also remaining backward compatible so I think we're good to merge this for the next release 🚢
We should also revisit the other missing named exports noted in upcoming changes for #2565. I'll leave a comment with more detail, but am thinking named exports might be best?
Super appreciate this contribution and details shared! 🎁
Summary
Fix ES module named export for App class
TypeScript's compilation of
export { default as App } from './App'to CommonJS doesn't create proper named exports for ES module interoperability.Before:
After:
Details
export { default as App }re-export pattern to explicitimport+exportNotes
npx --yes @arethetypeswrong/cli --from-npm @slack/bolt -f json