Hey @hmsk,
Thank you so much for your library, it is very valuable for me!
Currently, I'm building my blog with custom JSX support, e.g. I use the following ESBuild options:
esbuild: {
jsxFactory: "h",
jsxFragment: "Fragment",
jsxInject: `import { h, Fragment } from '@jsxRuntime'`,
},
Source - https://github.com/Beraliv/beraliv.dev/pull/668/files#diff-1a38a58d386f973a06d39a50569d0d08c97ca79921fb2cf0f21d0c3eed679a3bR7-R9
At the moment, I use Mode.HTML which outputs a big HTML string during build time, so in my JS scripts in DIST folder, I see not-well-optimised JS files.
To improve it, I'd like to post-process them in a similar way Vite processes custom JSX using the ESBuild options.
As you know far more than I do, I'm curious about how complicated this piece of work is.
Ideally, the pipeline should be the following:
- I have a Markdown file(s)
- I import Markdown file(s) (I do a lazy-loading in the router, but it can be a normal import)
- The config options (i.e. either as in
esbuild or custom) are specified to understand the transformation to JSX
- Each (if many) Markdown file is transformed to JSX
- Given JSX config options, JSX syntax is transformed to valid JS
- The output is JS module
Benefits:
- Minimal JS output file size (compared to HTML mode)
- Post-processing of HTML-file requires a lot of custom work (e.g. the following transformations are currently required: HTML => JSX, JSX => valid JS using custom JSX)
- Custom JSX support (not framework/library dependant, e.g. React, Svelte, Vue, etc)
What do you think?
If I'm missing any other alternatives, please let me know
Hey @hmsk,
Thank you so much for your library, it is very valuable for me!
Currently, I'm building my blog with custom JSX support, e.g. I use the following ESBuild options:
Source - https://github.com/Beraliv/beraliv.dev/pull/668/files#diff-1a38a58d386f973a06d39a50569d0d08c97ca79921fb2cf0f21d0c3eed679a3bR7-R9
At the moment, I use Mode.HTML which outputs a big HTML string during build time, so in my JS scripts in DIST folder, I see not-well-optimised JS files.
To improve it, I'd like to post-process them in a similar way Vite processes custom JSX using the ESBuild options.
As you know far more than I do, I'm curious about how complicated this piece of work is.
Ideally, the pipeline should be the following:
esbuildor custom) are specified to understand the transformation to JSXBenefits:
What do you think?
If I'm missing any other alternatives, please let me know