Hello, so I am trying to figure out how to use 11ty + JSX with Bun. I currently have 11ty + JSX with Node (TSX) working but for Bun I keep getting an error.
[11ty] Cannot find module 'react/jsx-dev-runtime' from 'eleventy-jsx/src/index.jsx' (via ResolveMessage)```
I am confused as to why it's looking for react/jsx-dev-runtime when I've set jsxImportSource to use 'jsx-async-runtime':
```json
"jsx": "react-jsx",
"jsxImportSource": "jsx-async-runtime",
"allowJs": true,
Eleventy.config.js:
import { jsxToString } from "jsx-async-runtime";
export default function(eleventyConfig) {
eleventyConfig.addTemplateFormats("tsx,jsx");
eleventyConfig.addExtension(["tsx", "jsx"], {
key: "11ty.js",
compile: function () {
return async (data) => {
let output = await this.defaultRenderer(data);
output = `<!doctype html>${await jsxToString(output)}`;
return output;
};
},
});
};
export const config = {
dir: {
input: "src",
output: "dist",
},
pathPrefix: "./",
};
src/index.jsx:
export default function Index() {
return (
<html>
<head>
<title>Document</title>
</head>
<body>
<h1>Hello!</h1>
</body>
</html>
);
}
export const render = Index;
Package.json:
{
"name": "jsx",
"module": "index.ts",
"type": "module",
"scripts": {
"eleventy": "npx tsx ./node_modules/.bin/eleventy --config=eleventy.config.js --serve",
"eleventy-bun": "bun run ./node_modules/.bin/eleventy --config=eleventy.config.js --serve"
},
"devDependencies": {
"@11ty/eleventy": "^3.0.0",
"@types/bun": "latest",
"jsx-async-runtime": "^0.6.2",
"tsx": "^4.19.2"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
}
Thanks in advance