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
While using
wrangler dev ./indexI getThis is caused due to the
entryvalue being verbatim what was used as a command line argument, ie../index, whereas theentryPointvalue inresult.metafile.outputshas 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.inputsinstead of theentryvalue: