-
-
Notifications
You must be signed in to change notification settings - Fork 927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is m.Fragment
going to be added in future version?
#2675
Comments
@idlist Can you not do |
I tried setting The modified configuration is like: const config = {
// other options
esbuild: {
jsxFactory: 'm',
jsxFragment: '"["'
}
} and Vite would throw this error:
esbuild seems to be the source of this issue (as discussed in #2660). I searched for a while for the possible difference in transpiling between babel and esbuild, but it seems to be no difference... |
Tried for some possible // fragment-polyfix.js
m.Fragment = '[' Other similar ways are also available, just simply defining a variable valued So I guess the only reason for In conclusion, this is not a problem of Mithril itself, and as I said in the beginning, it's okay if Mithril does not provide a Edit: I tried to open an issue under esbuild to see if they can add support of setting constant string to |
Since esbuild has added support to set literal string to |
I'm currently using Mithril in jsx syntax and using the solution in #2660. Is the
m.Fragment
going to be added in the further version of Mithril, or as the solution works, it would not be added?The consideration is that this issue is a certain to be met when using Mithril with jsx and esbuild (or other tools using esbuild like Vite). Although the first item of Googleing "mithril esbuild" would be #2660 so that finding the solution is not that hard. 🤔
Mithril version: 2.0.4
Browser and OS: Edge, Windows 10
Code
Currently I'm using the solution like:
Create a file named
fragment-polyfill.js
(although it is not really a polyfill)and in the first few lines of
index.js
, addand in
vite.config.js
, addThe text was updated successfully, but these errors were encountered: