Skip to content
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

esbuild-plugin-html does not use the original directory of the source file #128

Open
maartenst opened this issue Jan 26, 2023 · 9 comments · Fixed by #136
Open

esbuild-plugin-html does not use the original directory of the source file #128

maartenst opened this issue Jan 26, 2023 · 9 comments · Fixed by #136

Comments

@maartenst
Copy link

maartenst commented Jan 26, 2023

I'm trying to use esbuild-plugin-html with the esbuild-plugin-glob plugin to use it with several html files, like this:
[ "pages/**/*.html", "dynamic_pages/**/*.html"];

This breaks as the code now just uses the filename and not the directory. I hacked it to work by changing the creation of the finalOutputFile const in the index.js around line 28595 to this:
const finalOutputFile = `${workingDir}/${outDir}/${inputs[0]}`;

I'm not making a PR as I have a hard time understanding the original way of setting the path and what else in the code it affects but maybe you can have a look and adjust it so it does take the path into account?

@stale
Copy link

stale bot commented Mar 27, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Mar 27, 2023
@edoardocavazza
Copy link
Member

Hello @maartenst! Thanks for reporting!

The issue should be resolved in the latest version of the plugin. If you still notice any problems, feel free to reopen the issue.

@maartenst
Copy link
Author

Hi @edoardocavazza ,unfortunately it does not seem to work yet; I do see directories being created e.g. within 'dynamic_pages' but I still only have one resulting html file in the root of the dist dir, so it seems like the files aren't using the directory they are read from as a target to write to but just overwrite the one in the root of the dist target dir. Also I can't reopen this issue, can you or should I create a new one?

@edoardocavazza edoardocavazza reopened this Apr 5, 2023
@stale stale bot closed this as completed Apr 12, 2023
@stale stale bot removed the wontfix This will not be worked on label Apr 12, 2023
@maartenst
Copy link
Author

any progress on this?

@edoardocavazza
Copy link
Member

Hi @maartenst, I am sorry for the delay, I really wanted to fix this but haven't time yet. It would be very helpful for me to have a reproduction repository to test out 🙏

@maartenst
Copy link
Author

ok, I'll create one as soon as I have time, sometime this week probably, thanks!

@cowwoc
Copy link
Contributor

cowwoc commented Oct 3, 2024

I am seeing the same problem. If my entrypoints are ["index.html", "theme/ThemeChooser.html"] then I am seeing rna output two HTML files into the same directory. I am expecting ThemeChooser.html to be output into the theme subdirectory.

@cowwoc
Copy link
Contributor

cowwoc commented Oct 3, 2024

@edoardocavazza Looking at https://github.com/chialab/rna/pull/136/files#diff-c6783ff3262b589fcafddcb8136b1887bc87e55d9d36e39f91ff73479bd2d09aR122 I'm not sure why you removed [dir] from a bunch of places. Maybe putting it back would fix the problem?

@cowwoc
Copy link
Contributor

cowwoc commented Oct 3, 2024

Ah, nevermind. This was caused by user-error. My configuration was missing: entryNames: "[dir]/[name]". I'm guessing that the default configuration is equal to [name] which is why the directory was being stripped away. This works properly for me now.

@maartenst maybe you had the same problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants