Skip to content

Commit f94871d

Browse files
fix(bundler-plugin-core): bundle @actions/* for CJS dist
Inline @actions/core and @actions/github in unbuild (like @sentry/core) so require() of dist/index.cjs works; ESM-only @actions v3+ cannot be external. Set failOnWarn: false for expected inline dependency warnings. Update changeset. Made-with: Cursor
1 parent a97a1f7 commit f94871d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.changeset/bump-actions-toolkit.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Bump `@actions/core` to ^3.0.0 and `@actions/github` to ^9.0.0, and set `engines
66

77
**@actions/core** ([actions/toolkit `packages/core/RELEASES.md`](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md))
88

9-
- **v3.0.0**: ESM-only release; CommonJS callers must use dynamic `import()` instead of `require()`. `@codecov/bundler-plugin-core` already ships as ESM (`"type": "module"`), so this does not change how the package is consumed from modern bundlers and Node ESM.
9+
- **v3.0.0**: ESM-only release; apps that `require("@actions/core")` directly must use dynamic `import()`. **`@codecov/bundler-plugin-core` bundles `@actions/core` and `@actions/github` into `dist/index.cjs`**, so `require("@codecov/bundler-plugin-core")` (e.g. Rollup/Webpack CJS configs) keeps working.
1010
- **v2.x** (between 1.x and 3.x): Node 24 support and `@actions/http-client` upgrades (including 3.x in the 2.x line).
1111

1212
**@actions/github** ([actions/toolkit `packages/github/RELEASES.md`](https://github.com/actions/toolkit/blob/main/packages/github/RELEASES.md))
@@ -18,4 +18,5 @@ Bump `@actions/core` to ^3.0.0 and `@actions/github` to ^9.0.0, and set `engines
1818
**Impact here**
1919

2020
- Runtime behavior we rely on is unchanged: `context` for GitHub Actions metadata and `getIDToken()` for OIDC uploads are still the supported APIs.
21+
- **Build**: unbuild inlines `@actions/*` (and their transitive deps) like `@sentry/core`; `failOnWarn: false` suppresses expected “inlined implicit external” noise. Published `dist` is larger (~9 MB CJS) but avoids `ERR_PACKAGE_PATH_NOT_EXPORTED` for CJS consumers.
2122
- **Node 18** is no longer a supported runtime for this package; use **Node 20+** (aligned with `@actions/github` 8+ and this repo’s Volta pin on Node 20).

packages/bundler-plugin-core/build.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export default defineBuildConfig({
77
outDir: "dist",
88
declaration: "compatible",
99
sourcemap: true,
10+
// Inlining @actions/* pulls transitive deps (octokit, undici, …); unbuild warns about each.
11+
failOnWarn: false,
1012
rollup: {
1113
dts: {
1214
compilerOptions: {
@@ -29,7 +31,13 @@ export default defineBuildConfig({
2931
isResolved?: boolean,
3032
) => boolean;
3133
opts.external = (source, importer, isResolved) => {
32-
if (source === "@sentry/core") {
34+
// Bundle these into dist so CJS consumers never `require()` them.
35+
// @actions/* v3+ is ESM-only (no CJS "main"); externalizing breaks Rollup/Webpack CJS configs.
36+
if (
37+
source === "@sentry/core" ||
38+
source === "@actions/core" ||
39+
source === "@actions/github"
40+
) {
3341
return false;
3442
}
3543
return isExternal(source, importer, isResolved);

0 commit comments

Comments
 (0)