huozhi / bunchee

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

Production build overriding development build #548

Closed amannn closed 1 week ago

amannn commented 2 weeks ago

Apparently the order in which you define the development and production conditions has an effect on the resulting bundle. If you have a library with multiple entry points, let's say:

… where ./ re-exports from the sub pacakges, then index.development.mjs will point to core.production.mjs.

Repro: https://github.com/amannn/bunchee-test/commit/cc17248169a77d1e8babcd24a7fe9105454f845e

// dist/index.development.mjs
export * from './core.production.mjs';
export * from './react.production.mjs';

Listing production first is unfortunately not a viable workaround, as in this case dist/index.production.mjs will point to core.development.mjs.

huozhi commented 2 weeks ago

This is a very interesting bug 👀