huozhi / bunchee

Zero config bundler for ECMAScript and TypeScript packages
https://npmjs.com/bunchee
926 stars 29 forks source link

Should clear the whole dist folder #485

Open huozhi opened 6 months ago

huozhi commented 6 months ago

bunchee will clean folders like ./dist/es, /dist/cjs but not ./dist/test.ts if you create one.

Ideally the ./dist folder should be removed to avoid bad files are included

hyoban commented 6 months ago

Should we clear the common top-level directory for all exports?

nnecec commented 5 months ago

If someone wants bundle files to public directory, and there are some assets files that should keep. How do we know if the root dist folder needs to be removed?

{
  "exports": {
    ".": {
      "import": "./public/js/index.mjs",
      "require": "./public/js/index.cjs",
    }
  }
}
- public
  - assets
    - icon.svg
  - js ( in gitignore)
    - index.cjs
    - index.mjs
huozhi commented 5 months ago

We can clean the 1st common directory:

For this case:

"import": "./public/js/index.mjs",
"require": "./public/js/index.cjs",

We can clean ./public/js directory