I'm doing https://bun.sh/docs/runtime/loaders#jsx right now and I've created a react.tsx file, where I've copy/pasted the given code:
return (
<body>
<h1 style={{ color: 'red' }}>{props.message}</h1>
</body>
);
}
console.log(<Component message="Hello world!" />);
At first, when I ran bun run react.tsx I got the error error: Cannot find module "react/jsx-dev-runtime" from "/root/projects/bun/quickstart/react.tsx"
Then I ran bun add react and the command ran successfully
But when running bun run react.tsx, the output is: <NoName message="Hello world!" />
I would've expected it to be <Component message="Hello world!" />, or <react message="Hello world!" />
I've tried changing the file name to Component.tsx, but it didn't change the output, the first part is still "NoName".
Any idea why this might be happening?
I tried running
bun add react/jsx-dev-runtime
which led to bun add v1.0.18 (36c316a2) :mag: react [2/2] GET https://api.github.com/repos/react/jsx-dev-runtime/tarball/ - 404 error: react/jsx-dev-runtime failed to resolve