Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError while launching Wrangler without file extension, ie "./index" #78

Closed
jgentes opened this issue Dec 6, 2021 · 3 comments
Closed
Assignees

Comments

@jgentes
Copy link
Contributor

jgentes commented Dec 6, 2021

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 self-assigned this Dec 6, 2021
@jgentes jgentes linked a pull request Dec 6, 2021 that will close this issue
@jgentes
Copy link
Contributor Author

jgentes commented Jan 6, 2022

Fixed in #196

@jgentes jgentes closed this as completed Jan 6, 2022
threepointone added a commit that referenced this issue 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
Copy link
Contributor

reopening this since it got reverted in #262

@threepointone threepointone reopened this Jan 18, 2022
threepointone added a commit that referenced this issue 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 issue 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
Copy link
Contributor

Fixed in #258

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants