-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Proposal] Html as entry point #419
Comments
It would be nice to have ability to prototype such loader using only plugins api but the problem with plugins api is that it's not clear how to add some code into processing pipeline. |
@evanw do you think this aligns with your vision of the project. I think I can implement something like this, I could use https://godoc.org/golang.org/x/net/html as parser/tokenizer and then it will only require to find import tokens. Let me know what do you think about this. |
Yes I would like to try supporting this eventually. This issue is actually a duplicate of a much older issue about this #31, so I'm going to close this one as a duplicate of that. Right now I'm focused on fixing code splitting, improving CSS support, and getting plugins out the door, so I wasn't planning on also taking on HTML at the same time. That seems like kind of too many balls in the air at once to me given how major a feature HTML support is. Believe me I want HTML support too but it's sort of a maximally complex file format given how it can nest other file formats inside of itself. That's very interesting that there's a HTML5 tokenizer built into the Go standard library. I wasn't aware of that. That definitely warrants an exploration, although if something about it doesn't quite work out it's possible that it makes more sense to still rewrite it in-house given that it would be a core competency of esbuild.
I think exploring what it would take for a HTML plugin would be very valuable. There are likely other situations where the same APIs would be useful, so this is bringing up a deficiency in the plugin API. Right now you can add additional code into the processing pipeline by importing it (e.g. with |
From plugin developer perspective I'd need api which will allow me retrieve the value of the current chunk.
|
I wanted to setup my story book to work with with esbuild. I was using regular cra with a few plugins before, now I switched to esbuild. I managed to migrate almost everything, I had issue with prismjs because it uses globals, some issues with emotion because it required custom jsx pragma.
So far my biggest concerns are watch mode and lack of html support.
As for html, for regular spa application workflow you usually have some public file with html which has some defintions for style and scripts import. Here is the example:
Right now to ge app working you have to do some workarounds where you copy index.html to build folder manually and hardcode index.js and index.css, also you would need to copy all the icons, fonts, styles and other dependencies.
I think we should integrate html as first class citizen for entry points. I'd consider implementing limited subset of html with only support for head and script imports and no actual body parsing.
The text was updated successfully, but these errors were encountered: