parcel: Index.html can not be omitted when serving multiple files
π bug report
When bundling and serve multiple entry files, / index.html
can not be accessed with localhost:1234/
However, you can access it with localhost: 1234 / index.html
π Configuration (.babelrc, package.json, cli command)
//- src/index.pug
h1 hello world!
//- src/sub.pug
h1 sub page!
$ parcel 'src/**/*.pug'
π€ Expected Behavior
When accessing localhost:1234/
, βhello world!β is displayed
π― Current Behavior
Accessing localhost:1234/
will display empty HTML
<html>
<head></head>
<body></body>
</html>
However, accessing localhost: 1234 / index.html
will display the page correctly
π Possible Solution
I do not know, but when accessed with /
we have to make sure to check the existence of / index.html
π Your Environment
Software | Version(s) |
---|---|
Parcel | v1.8.1 |
Node | v8.11.1 |
npm/Yarn | v6.0.0/v1.5.1 |
Operating System | MacBook Pro (High Sierra) |
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 16
- Comments: 16 (3 by maintainers)
Commits related to this issue
- Add about page, work around no index.html See: https://github.com/parcel-bundler/parcel/issues/1315 — committed to pwmarcz/autotable by pwmarcz 4 years ago
In the meantime, I have this workaround set up:
then run
node run-parcel.js
instead ofparcel src/*.html
.Looks like lots of people requesting this feature, any word on whether thereβs even a workaround to solve this?
Is there any news on this issue?
Same here, just ran into this, with the whole team confused as to what happened, when the second entry point was first added.
Same here. Any updates?
Iβve got a working solution for this (as explained in #1778) and can PR if this is agreeable.
Essentially, it enhances the
respond
method by looking for indexes (with a method replacingsendIndex
calledfindIndex
), looking for the main bundle as it does now, failing that looking for an HTML file calledindex.html
.Same happened here when
parcel *.html
.That actually confused my colleague and thought the computer was under the weather lol It would be nice to solve this issue. It would avoid any confusion in the future.
I ended up writing a local plugin as a bandaid, until we get a legit fix. It uses the same modules included in Parcel v1. Only gotcha is you have to use the
watch
command to trigger it. Hereβs an example of what it looks like - ymmv:Running
Plugin Code
Looking forward to this feature!