You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These are unfortunately pretty unergonomic when using Preact. If I use the options "JSXFactory" "h" "JSXFragment" "Fragment", I have to prepend an (otherwise unused) import { h, Fragment } from 'preact'; before every JSX file.
It would probably be possible to work around that using inject, but ESBuild has two newer options that don't require such workarounds anymore, JSXImportSource and JSX: https://esbuild.github.io/api/#jsx-import-source
I would appreciate if it was possible to set these through Hugo. Currently, the only way I've seen to set these would be on a per-file level like this:
Hugo already has support for passing the
JSXFactory
andJSXFragment
options to ESBuild:hugo/resources/resource_transformers/js/options.go
Lines 416 to 417 in 16406d9
These are unfortunately pretty unergonomic when using Preact. If I use the options
"JSXFactory" "h" "JSXFragment" "Fragment"
, I have to prepend an (otherwise unused)import { h, Fragment } from 'preact';
before every JSX file.It would probably be possible to work around that using
inject
, but ESBuild has two newer options that don't require such workarounds anymore,JSXImportSource
andJSX
: https://esbuild.github.io/api/#jsx-import-sourceI would appreciate if it was possible to set these through Hugo. Currently, the only way I've seen to set these would be on a per-file level like this:
If there is interest in supporting those two options, I'm happy to submit a PR. Thanks!
The text was updated successfully, but these errors were encountered: