huozhi / bunchee

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

Multiple runtime will read the same input file #413

Closed himself65 closed 10 months ago

himself65 commented 10 months ago

https://github.com/huozhi/bunchee#multiple-runtime

for this input

  "exports": {
    ".": {
      "types": "./dist/index.d.mts",
      "edge-light": "./dist/edge.mjs",
      "import": "./dist/index.mjs",
      "require": "./dist/index.js"
    }
  },

bunchee will always read index.ts but output to edge.mjs and others output.

I expect to read different inputs and generate different outputs.

huozhi commented 10 months ago

You can use index.edge-light.ts to have the different output, index.<special export condition>.ts is the convention for different community standard conventions. So far we suppor development, production, edge-light, react-server, react-native.

Worth to update the docs a bit to clarify that

himself65 commented 10 months ago

You can use index.edge-light.ts to have the different output, index.<special export condition>.ts is the convention for different community standard conventions. So far we suppor development, production, edge-light, react-server, react-native.

Worth to update the docs a bit to clarify that

Thanks for the feedback. I will try that