-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
HTML entry points do not respect custom output path #2828
Comments
No, this is a bug. I haven't considered this edge case before but I'd expect this to work too. Thanks for the bug report. Edit: I think you'd have to do this instead once this bug has been fixed: build({
bundle: true,
entryPoints: {
"./index": "./src/index.ts",
- "./index.html": "./public/index.html",
+ "./index": "./public/index.html",
},
format: "esm",
loader: { ".html": "copy" },
outdir: "./dist",
}); The reason is because the extension is always implicit with the way the custom entry point output paths feature currently works. |
So there can't be entry points with the same basename right? i.e. |
Yeah... That's not a limitation of the underlying engine though. It works in Go and the CLI. It's just a limitation of the JS shim. I chose a JS mapping over an array for syntax convenience, but then of course you can't do this. I should also allow an array of some form too. Thanks for calling this out. |
@evanw Does esbuild have similar html plugin as html-webpack-plugin which can auto render index.html template and fill in with |
I found esbuild-plugin-html. It helped me solve same problem. |
Hi :)
The ability of copying HTML files to the output directory with the
copy
loader is very useful. Unfortunately, for my scenario it only "kind of" works:This results in
which is not the desired layout (
index.html
should be in the directory asindex.js
).It does not matter what the custom output path of
./public/index.html
is, the output structure will always be the same.I would like to avoid putting the
index.html
in./
or./src
, which would both work because with./
I could manipulate the output path ofindex.ts
and with./src
both files are in the same directory.However, I found a hacky way to make it work:
Result:
This feels like an unnecessary solution though. Is it intended to ignore the custom output path for HTML files?
The text was updated successfully, but these errors were encountered: