huozhi / bunchee

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

[Feature Request] Conditional configuration for CLI #516

Open PinkChampagne17 opened 2 months ago

PinkChampagne17 commented 2 months ago

I've been using bunchee and noticed slight differences in behavior between the CLI and Node.js API, leading to the configuration doesn't meet all my needs.

I propose adding a feature that allows the use of a JS configuration file like other bundlers (maybe another better way), allowing for conditional configuration based on the environment or other conditions.

huozhi commented 2 months ago

Can you share the example of what config you want to set based on the environment. Cause we’re building a zero-config bundler. I don’t want to add a config file to break the original intention of this library

PinkChampagne17 commented 2 months ago

Can you share the example of what config you want to set based on the environment. Cause we’re building a zero-config bundler. I don’t want to add a config file to break the original intention of this library

I want to bundle with minification but except during development. Refer to doc of tsup - Conditional config, which makes it easier to reuse CLI flags in package.json and appropriately adjust based on circumstances

nnecec commented 2 months ago

You can try this way.


{
  "scripts": {
     "dev": "bunchee -w",
     "build": "bunchee -m"
  }
}