-
Notifications
You must be signed in to change notification settings - Fork 21
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
Can we have assets in a separate directory to the main html file? #43
Comments
Hello @jasonwilliams! Would you give a try to the version 0.15.3 of the plugin? It should now respect the |
The output is exactly the same, also its printing a huge array of files out when i run build. Did you leave a console.log in there? how do i utilise |
In the main esbuild config i set
It generated an assets folder but but it was empty When i set {
"entryNames": "[name]-[hash]",
"assetNames": "assets/[name]-[hash]",
} I get
It looks like it bases everything off the "entryNames" not the "assetNames" |
Oops, I forgot a console.log, removed in 0.15.4. I hadn't see before that your assets were CSS and JS files. Those files are considered chunks by esbuild, not assets. You have to set |
That's perfect thanks! |
I would definitely update the documentation as im sure this would be useful to others too. Right now it's a bit hidden knowledge |
If you use images or fonts references in the index.html entrypoint or in you CSS, you have to keep the Thanks for your feedback, I certainly will update the usage section. |
Does this new configuration solve #35? |
Yes and this issue too thanks |
Hey @edoardocavazza sorry to bring this back up, but serve mode fails now. Do you happen to know why?
That file does exist, so i don't know why it says it can't find it. My guess is it should be checking This line looks suspicious: build mode works fine |
I am not sure the html plugin can even work in serve mode. Probably, the error is given by the fact you have previously build the application. If you remove the public folder and then start the server, you can see that esbuild does not generate the index.html file at all. That's because esbuild does not write anything to fs in server mode. I'll add this notice to the doc. |
That would be a shame if this didn't work in serve mode. Why do you think it wouldn't be possible? It looks like esbuild is designed to work with plugins in serve mode
I tried that, it made no difference sadly. Its true no index.html gets generated but the assets do. Only the index.html seems to be in memory. |
I’m going to close this in favour of #44 as the original issue here was fixed |
Hey @edoardocavazza I just noticed in watch mode (not serve), its generating new assets but the html file isn't being updated to point to the new ones. I think this may be a bug |
So my previous webpack config would generate something which looked like this.
html-webpack-plugin
This was useful to us because we didn't want the main entry point (index.html) to be hashed. it also allowed us to serve static assets from a different place.
@chialab/[email protected]
generates this:We don't want the main entry point hashed, and we would like the assets (JS and css files) to be in a separate directory.
Is this possible for you to implement?
The text was updated successfully, but these errors were encountered: