Open laidrivm opened 3 months ago
1.1.21
Darwin 23.5.0 arm64 arm
git clone https://github.com/laidrivm/bun-elysia-jsx-blog.git
cd bun-elysia-jsx-blog
mkdir articles
nano articles/index.md
bun install
bun run build
bun run prod
docker build --pull -t blog .
docker run -d -p 3000:3000 blog
Code build locally and in Docker works the same.
In Docker there are differences in build lead to JSX failure
The code in original generate.tsx, from there everything in Docker's version goes wrong in any JSX used. Let's take for the example:
const fullJsx = ( <Page title={title} content={contentHtml} includeArrow={true}/> );
In Docker version it build to this in generate.js:
var hasAnyProps = function(obj) { for (let key in obj) return true; return false; }; var mergeDefaultProps = function(props, defaultProps) { var result = __create(defaultProps, __descs(props)); for (let key in defaultProps) { if (result[key] !== undefined) continue; result[key] = defaultProps[key]; } return result; }; var __create = Object.create; var __descs = Object.getOwnPropertyDescriptors; var __merge = (props, defaultProps) => { return !hasAnyProps(defaultProps) ? props : !hasAnyProps(props) ? defaultProps : mergeDefaultProps(props, defaultProps); }; var $$typeof = Symbol.for("react.element"); var ArticleList = ({ links }) => ({ $$typeof, type: "ul", key: null, ref: null, props: { children: links.map((link2) => ({ $$typeof, type: "li", key: null, ref: null, props: { children: { $$typeof, type: "a", key: null, ref: null, props: { href: link2, children: link2 }, _owner: null } }, _owner: null })) }, _owner: null });
Then console.log(fullJsx) prints <NoName ... /> — and renderToString(fullJSX) returns nothing instead of rendered html.
console.log(fullJsx)
<NoName ... />
and renderToString(fullJSX)
While in locally built generate.js it converts to:
var ArticleList = ({ links }) => u3("ul", { children: links.map((link2) => u3("li", { children: u3("a", { href: link2, children: link2 }, undefined, false, undefined, this) }, undefined, false, undefined, this)) }, undefined, false, undefined, this);
and everything goes smoothly.
Both local and Docker bun --version are 1.1.21.
I've also checked the differences between local and Docker node_modules/, but they're only in dev dependencies, which is as expected.
I believe there's something with base oven/bun Docker image, that's why I'm opening this issue.
What version of Bun is running?
1.1.21
What platform is your computer?
Darwin 23.5.0 arm64 arm
What steps can reproduce the bug?
git clone https://github.com/laidrivm/bun-elysia-jsx-blog.git
cd bun-elysia-jsx-blog
mkdir articles
nano articles/index.md
bun install
bun run build
bun run prod
docker build --pull -t blog .
docker run -d -p 3000:3000 blog
What is the expected behavior?
Code build locally and in Docker works the same.
What do you see instead?
In Docker there are differences in build lead to JSX failure
Additional information
The code in original generate.tsx, from there everything in Docker's version goes wrong in any JSX used. Let's take for the example:
In Docker version it build to this in generate.js:
Then
console.log(fullJsx)
prints<NoName ... />
—and renderToString(fullJSX)
returns nothing instead of rendered html.While in locally built generate.js it converts to:
and everything goes smoothly.
Both local and Docker bun --version are 1.1.21.
I've also checked the differences between local and Docker node_modules/, but they're only in dev dependencies, which is as expected.