From fc112d74fe212f32e585865df96999a894062801 Mon Sep 17 00:00:00 2001 From: James Gentes Date: Fri, 14 Jan 2022 01:13:14 -0800 Subject: [PATCH] allow specifying only "index" without extension or nothing at all to launch "wrangler dev" (#196) * change entryPoint === entry to entryPoint === Object.keys(result.metafile.inputs)[0] * changeset added * changed to patch * added change for publish as well * Update loud-dolls-pay.md Co-authored-by: Sunil Pai --- .changeset/loud-dolls-pay.md | 5 +++++ packages/wrangler/src/dev.tsx | 3 ++- packages/wrangler/src/publish.ts | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/loud-dolls-pay.md diff --git a/.changeset/loud-dolls-pay.md b/.changeset/loud-dolls-pay.md new file mode 100644 index 000000000000..de5a29cc448c --- /dev/null +++ b/.changeset/loud-dolls-pay.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +allow specifying only "index" without extension or nothing at all for "wrangler dev" and "wrangler publish" diff --git a/packages/wrangler/src/dev.tsx b/packages/wrangler/src/dev.tsx index 4aa5329d4b11..bdbe64baf768 100644 --- a/packages/wrangler/src/dev.tsx +++ b/packages/wrangler/src/dev.tsx @@ -475,7 +475,8 @@ function useEsbuild(props: { }); const chunks = Object.entries(result.metafile.outputs).find( - ([_path, { entryPoint }]) => entryPoint === entry + ([_path, { entryPoint }]) => + entryPoint === Object.keys(result.metafile.inputs)[0] ); // assumedly only one entry point setBundle({ diff --git a/packages/wrangler/src/publish.ts b/packages/wrangler/src/publish.ts index bbb6ef3dfa26..128a497ecbaa 100644 --- a/packages/wrangler/src/publish.ts +++ b/packages/wrangler/src/publish.ts @@ -134,7 +134,7 @@ export default async function publish(props: Props): Promise { entryPoint === (props.public ? path.join(path.dirname(file), "static-asset-facade.js") - : file) + : Object.keys(result.metafile.inputs)[0]) ); const { format } = props;