Skip to content

Commit

Permalink
[dev-tool] use the main field as bundled cjs output name (#26119)
Browse files Browse the repository at this point in the history
instead of hard-coded `dist/index.js`.
  • Loading branch information
jeremymeng authored Jun 7, 2023
1 parent bdb4493 commit e04622b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions common/tools/dev-tool/src/commands/run/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@ export default leafCommand(commandInfo, async (options) => {

try {
const bundle = await rollup.rollup(baseConfig);

const cjsOutput = info.packageJson.main;
if (!cjsOutput) {
throw new Error("Expecting valid main entry");
}
await bundle.write({
file: "dist/index.js",
file: cjsOutput,
format: "cjs",
sourcemap: true,
exports: "named",
Expand Down

0 comments on commit e04622b

Please sign in to comment.