Skip to content

allow specifying only "index" without extension or nothing at all to launch "wrangler dev"#196

Merged
threepointone merged 5 commits intomainfrom
issue-78-fixed
Jan 14, 2022
Merged

allow specifying only "index" without extension or nothing at all to launch "wrangler dev"#196
threepointone merged 5 commits intomainfrom
issue-78-fixed

Conversation

@jgentes
Copy link
Copy Markdown
Contributor

@jgentes jgentes commented Jan 6, 2022

While using wrangler dev ./index I get

TypeError: Cannot read properties of undefined (reading '0')
    at null.build (/home/jgentes/workers/wrangler2/packages/wrangler/src/dev.tsx:411:15)

This is caused due to the entry value being verbatim what was used as a command line argument, ie. ./index, whereas the entryPoint value in result.metafile.outputs has the extension added to the file, ie ./index.js.

I'm going to submit a PR that uses what esBuild recognizes as the input value in result.metafile.inputs instead of the entry value:

const chunks = Object.entries(result.metafile.outputs).find(
        ([_path, { entryPoint }]) =>
          entryPoint === Object.keys(result.metafile.inputs)[0]
      ) // assumedly only one entry point

@jgentes jgentes requested a review from threepointone as a code owner January 6, 2022 18:57
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jan 6, 2022

🦋 Changeset detected

Latest commit: fc2ad31

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor

@JacobMGEvans JacobMGEvans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, looking forward to the bonus wrangler dev using default entrypoint

Copy link
Copy Markdown
Contributor

@threepointone threepointone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

@threepointone threepointone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@threepointone threepointone merged commit fc112d7 into main Jan 14, 2022
@threepointone threepointone deleted the issue-78-fixed branch January 14, 2022 09:13
@github-actions github-actions bot mentioned this pull request Jan 14, 2022
threepointone added a commit that referenced this pull request Jan 18, 2022
We introduced some bugs in recent PRs:

- In #196, we broke being able to pass an entrypoint directly to the cli. In this PR, I just reverted that fix. I'll reopen #78 and we'll tackle it again later. (cc @jgentes)
- In #215, we broke being able to publish a script by just passing `--latest` or `--compatibility-data` in the cli. This PR fixes that by reading the correct argument when choosing whether to publish.
- In #247, we broke how we made requests by passing headers to requests. This PR reverts the changes made in `cfetch/internal.ts`. (cc @petebacondarwin)
- In #244, we broke `dev` and it would immediately crash. This PR fixes the reference in `dev.tsx` that was breaking. (cc @petebacondarwin)
threepointone added a commit that referenced this pull request Jan 18, 2022
We introduced some bugs in recent PRs:

- In #196, we broke being able to pass an entrypoint directly to the cli. In this PR, I just reverted that fix. I'll reopen #78 and we'll tackle it again later. (cc @jgentes)
- In #215, we broke being able to publish a script by just passing `--latest` or `--compatibility-data` in the cli. This PR fixes that by reading the correct argument when choosing whether to publish.
- In #247, we broke how we made requests by passing headers to requests. This PR reverts the changes made in `cfetch/internal.ts`. (cc @petebacondarwin)
- In #244, we broke `dev` and it would immediately crash. This PR fixes the reference in `dev.tsx` that was breaking. (cc @petebacondarwin)
@github-actions github-actions bot mentioned this pull request Jan 18, 2022
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

4 participants