# Ship cleaner packages (without the ./dist or ./src folder) by publishing a subfolder to NPM

DevFeed: [Ship cleaner packages (without the ./dist or ./src folder) by publishing a subfolder to NPM](<https://devfeed.tech/articles/ship-cleaner-packages-without-the-dist-or-src-folder-by-publishing-a-subfolder-to-npm-55628.md>)

Original publisher: [Read original article](<https://www.bram.us/2026/09/20/npm-publish-subfolder/>)

Author: Bramus!

Published: 2026-09-20T17:38:20Z

Content type: tutorial

Language: en

Sources: [Bram.us](<https://devfeed.tech/sources/bram-us.md>)

Topics: [npm](<https://devfeed.tech/topics/npm.md>), [Publishing](<https://devfeed.tech/topics/publishing.md>)

Tags: [npm](<https://devfeed.tech/tags/npm.md>), [original-content](<https://devfeed.tech/tags/original-content.md>), [packages](<https://devfeed.tech/tags/packages.md>), [publishing](<https://devfeed.tech/tags/publishing.md>)

## AI overview

A tutorial on using npm publish with a subfolder as the package root, allowing packages built from directories such as dist to expose cleaner import paths without leaking internal folder structure. It also discusses the difference between Node.js and CDN consumers and notes that pnpm supports a related setting.

## Source excerpt

One detail that has always bugged me about publishing a package to NPM is how build output paths like dist/ can leak into the public API. Turns out, npm publish can do it, but to make it work seamlessly in a real-world project, you need a few extra pieces in place. Let me walk you through how it works.