Esbuild Project Feasibility Question
- Dominant language
- Go
- Stars
- 40.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
This is not an issue report but more of an architectural/feasibility question.
I'm currently working on something to convert from JSX code to es2015.
The context here is that I have a serverless function running a node.js runtime. I'm passing in JSX code as a string and I'd like for it to convert the code to es2015 for which the code, if injected into any tag would be runnable. As part of the JSX code, it is possible for it to import some Material UI libraries (which are present in the package.json in the node.js runtime).
What is the proper way for esbuild to generate a standalone JS string to copy/paste within a <script> tag to get all the components to run in a standalone setting?
When I look at the outputted code currently of just "import Dialog from '@mui/material/Dialog'" - I do see that esbuild.transform does create some es2015 code. However - looking at the code itself, it doesn't appear that the MaterialUI components are packaged within the generated JS itself but instead, the generated code has a require() statement which fails on the client side with
`Uncaught ReferenceError: require is not defined`
Again - this is not an issue with the esbuild package but more of an ask if this is feasible at all.
Contributor guide
No contributing guide indexed for this repository
Research direction
No source file or test is named; begin with the esbuild.transform path described in the issue and compare it with the requested JSX-to-ES2015 standalone script scenario. Done means establishing whether imports such as @mui/material/Dialog can be included without requiring a client-side Node.js runtime, or documenting the feasibility limits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, react
- Domain
- build-system, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100