Skip to content

Fix published package missing its build output - #49

Merged
isker merged 1 commit into
isker:masterfrom
Schleuse:fix-published-build-output
Sep 7, 2026
Merged

isker merged 1 commit into
isker:masterfrom
Schleuse:fix-published-build-output

Conversation

@Schleuse

@Schleuse Schleuse commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

neogrok@1.2.2 on npm ships 5 files and no build/ directory, so running it fails right away:

error: Cannot find module './build/handler.js' from '.../node_modules/neogrok/main.js'

For comparison, 1.2.1 contains 1152 build/ entries, including the build/handler.js and build/env.js that main.js imports.

Cause: the build output was produced by prepublishOnly, which is an npm-only lifecycle script. changesets 2 always published via npm publish, so it ran. changesets 3 (#0076168) detects the package manager and uses yarn npm publish for this repo's packageManager: yarn@4.18.0, and Yarn Berry implements only prepublish/prepack/postpack. The release job runs just yarn install, so build/ never existed and files: ["build"] matched nothing.

Fix: use prepack, which both Yarn Berry and npm run when packing or publishing.

1.2.2 was published without `build/`, so `main.js` fails immediately with
"Cannot find module './build/handler.js'".

The build output came from `prepublishOnly`, which only npm implements.
Since the upgrade to changesets 3, publishing goes through
`yarn npm publish` (changesets 3 detects the package manager, where
changesets 2 always shelled out to `npm publish`), and Yarn Berry does not
run `prepublishOnly`. Nothing built `build/` during the release job, and the
`files: ["build"]` entry matched nothing.

`prepack` runs for both `yarn npm publish`/`yarn pack` and
`npm publish`/`npm pack`, so the build output is produced regardless of
which tool changesets picks.
@isker

isker commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Thank you. Sorry for the breakage.

@isker
isker merged commit 049339b into isker:master Sep 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants