Skip to content

chore: add .npmignore so dist is published explicitly - #1455

Merged
Tony133 merged 1 commit into
mainfrom
chore/add-npmignore
Dec 2, 2026
Merged

Tony133 merged 1 commit into
mainfrom
chore/add-npmignore

Conversation

@Tony133

@Tony133 Tony133 commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Proposal:

The files field was removed from package.json in 4fde58b so that the whole repository is published to npm. Without files and without a .npmignore, npm falls back to .gitignore, which lists dist. Today dist is still packed only because main is written without the ./ prefix, which is a side effect and not something to rely on: changing main to ./dist/index.js would silently drop the build output from the package.

What

Adds a .npmignore, following the approach used by Eomm in fastify/fastify-type-provider-zod#34. It is a copy of .gitignore without the dist entry, so the build output is published.

package.json is not changed.

The same approach was released as @fastify/type-provider-zod@1.0.4, which contains the full repository plus dist.

How to verify

npm install --ignore-scripts
npm run release:build
npm pack --dry-run

The file list must include dist/ together with the rest of the repository files (103 files in total). .gitignore, .npmignore and .npmrc are not published: npm excludes them by default.

Note:

@Tony133
Tony133 force-pushed the chore/add-npmignore branch from b7ad68c to b402bc7 Compare December 1, 2026 18:36
@Tony133
Tony133 force-pushed the chore/add-npmignore branch from b402bc7 to 8ad8412 Compare December 1, 2026 18:45
@Tony133
Tony133 merged commit 52e988f into main Dec 2, 2026
38 of 39 checks passed
@Tony133
Tony133 deleted the chore/add-npmignore branch December 2, 2026 10:23
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