Skip to content

Commit 66f1ec6

Browse files
committed
Rename to cjs for improved support
1 parent edbc16b commit 66f1ec6

5 files changed

Lines changed: 430 additions & 433 deletions

File tree

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
A GitHub Action that sends messages, reactions, threads, and block-based messages to Slack via the Slack API. Written in JavaScript with one runtime dependency: `@actions/core`.
88

9-
- **Action entry point:** `dist/index.js` (compiled bundle — never edit this directly)
9+
- **Action entry point:** `dist/index.cjs` (compiled bundle — never edit this directly)
1010
- **Source entry point:** `index.js``src/invoke.js`
1111

1212
## Commands
@@ -15,7 +15,7 @@ A GitHub Action that sends messages, reactions, threads, and block-based message
1515
npm test # Run Jest unit tests (src/ only)
1616
npm run test-debug # Debug Jest with Node inspector
1717
npm run lint # ESLint with auto-fix
18-
npm run build # Compile dist/index.js via esbuild (required before deploy)
18+
npm run build # Compile dist/index.cjs via esbuild (required before deploy)
1919
```
2020

2121
Integration test (requires real Slack token):
@@ -27,7 +27,7 @@ $env:BOT_USER_OAUTH_ACCESS_TOKEN="<token>"; $env:CHANNEL="<channel-id>"; node in
2727
BOT_USER_OAUTH_ACCESS_TOKEN=<token> CHANNEL=<channel-id> node integration-test/end-to-end.js
2828
```
2929

30-
**After any source change, run `npm run build` to update `dist/index.js`.** The action runs from `dist/index.js`, not the source files.
30+
**After any source change, run `npm run build` to update `dist/index.cjs`.** The action runs from `dist/index.cjs`, not the source files.
3131

3232
## Architecture
3333

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ It was a good way to learn more about Github Actions
409409

410410
This action is just an HTTPS POST to Slack API, so you can easily build this by yourself, or use this, or use any other action available on the marketplace :)
411411

412+
## v2 → v3: CommonJS vs ES Modules
413+
414+
The source code moved from CommonJS (`require`) to ES Modules (`import`/`export`) in v3, with `"type": "module"` in `package.json`. However, the bundled action entry point (`dist/index.cjs`) is still built as CommonJS using esbuild. This is intentional for now,`@actions/core` and its dependencies (e.g. `tunnel`) use dynamic `require()` calls for Node built-ins like `net` and `tls`, which fail at runtime inside an ESM bundle. Building the action as CJS avoids this.
415+
412416
## Development and testing
413417

414418
See package.json for `yarn lint`, `yarn test`, etc.

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@ outputs:
7979
description: "The result from the post to slack"
8080
runs:
8181
using: "node24"
82-
main: "dist/index.js"
82+
main: "dist/index.cjs"

0 commit comments

Comments
 (0)