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

switch from entry to result.metafile.inputs #79

Closed
wants to merge 1 commit into from
Closed

Conversation

jgentes
Copy link
Contributor

@jgentes 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

@changeset-bot
Copy link

changeset-bot bot commented Dec 6, 2021

⚠️ No Changeset found

Latest commit: 9330ed8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

@jgentes jgentes linked an issue Dec 6, 2021 that may be closed by this pull request
@Electroid
Copy link
Contributor

@jgentes Would you be able to re-commit without the formatting changes? It's hard to see what changed.

Copy link
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.

Great catch, thanks for the PR! Like ashcon said, could you remove all the formatting changes? It looks like your IDE also removed some type imports. Part of this is my fault too, I should setup a prettier/lint ci check, as well as an ide config for your ide to pick up. Will approve this once it's submitted with only the functional changes, thank you!

@Electroid Electroid added the bug label Dec 9, 2021
@jgentes jgentes closed this Jan 6, 2022
@jgentes
Copy link
Contributor Author

jgentes commented Jan 6, 2022

Re-submitted as #196

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 this pull request may close these issues.

TypeError while launching Wrangler without file extension, ie "./index"
3 participants