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

index.html detection only works if the file is explicitly referenced. #6850

Closed
lgarron opened this issue Sep 1, 2021 · 1 comment
Closed
Labels
Stale Inactive issues

Comments

@lgarron
Copy link

lgarron commented Sep 1, 2021

🐛 bug report

Links to /folder1/ only serve the content of /folder1/index.html if the file path to /folder1/index.html is explicitly referenced elsewhere in the project.

🎛 Configuration (.babelrc, package.json, cli command)

Suppose we have three folders, each containing an index.html file:

<!-- index.html -->
<a href="folder1/">folder1</a>
<a href="folder2/index.html">folder2</a>

<!-- folder1/index.html -->
hi!

<!-- folder2/index.html -->
also hi!

Run:

npx parcel index.html

🤔 Expected Behavior

Link #1 goes to /folder1/ (e.g. http://localhost:1234/folder1/) and serves the contents of folder1/index.html.

😯 Current Behavior

Link #1 goes to /folder1/ but serves the root content. Clicking again goes to /folder1/folder1/, /folder1/folder1/folder1/, etc.

💁 Possible Solution

Detect the index.html mapping in the graph calculation?

At the moment, I'm able to use this workaround:

<a href="folder1/index.html" hidden></a>
<a href="folder1/">folder2</a>

It seems that the first URL causes Parcel to recognize that folder3 has an index file, and subsequently serves it when the visible link is clicked. It would be nice if something like this worked automatically.

🔦 Context

I'm trying to convert https://github.com/cubing/cubing.js/ back to Parcel and this is breaking our links.

💻 Code Sample

See above.

🌍 Your Environment

Parcel 2.0.0-rc.0
npm 7.21.0
node v16.8.0
macOS 11.5.2

lgarron added a commit to cubing/cubing.js that referenced this issue Sep 1, 2021
lgarron added a commit to cubing/cubing.js that referenced this issue Sep 1, 2021
lgarron added a commit to cubing/cubing.js that referenced this issue Sep 16, 2021
lgarron added a commit to cubing/cubing.js that referenced this issue Oct 2, 2021
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

@github-actions github-actions bot added the Stale Inactive issues label Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Inactive issues
Projects
None yet
Development

No branches or pull requests

1 participant