unbuild icon indicating copy to clipboard operation
unbuild copied to clipboard

export `inferEntries` in `src/index`

Open Codpoe opened this issue 2 years ago • 1 comments

Describe the feature

Hi~ I want to reuse the auto-inferred build entries in build.config.ts, and then make some changes on this basis. I don't know if it can be implemented?

Additional information

  • [x] Would you be willing to help implement this feature?

Codpoe avatar Sep 28 '23 03:09 Codpoe

import { defineBuildConfig } from "unbuild";

export default defineBuildConfig({
  entries: ["src/index.ts"],
  outDir: "dist",
  declaration: true,
  hooks: {
   'build:before'(ctx) {
    // ↓ You mean this? (Or other hooks)
    console.log('ctx.options.entries', ctx.options.entries)
    // =>
    // [
    //   {
    //     input: '/.../examples/1.zero-config/src/index.ts',
    //     name: 'index',
    //     builder: 'rollup',
    //     declaration: true,
    //     outDir: '/.../examples/1.zero-config/dist'
    //   }
    //   ...
    // ]
   }
  }
});

kricsleo avatar Feb 11 '25 03:02 kricsleo