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

Client side routing with multiple entrypoints #4142

Closed
atrauzzi opened this issue Feb 16, 2020 · 12 comments · Fixed by #6250
Closed

Client side routing with multiple entrypoints #4142

atrauzzi opened this issue Feb 16, 2020 · 12 comments · Fixed by #6250

Comments

@atrauzzi
Copy link

🐛 bug report

(I think this problem description is simple enough that the full template is a bit overkill.)

I'm running with multiple entrypoints on the dev server, when an HMR reload is triggered, I get a 404 because it attempts to resolve the exact path (something like /myapp.html/some/route) rather than simply serving /myapp.html and allowing the client-side routing to take over for the /some/route portion.

Is this supported currently?

@devongovett
Copy link
Member

Please fill out the template. It's useful to know e.g. your parcel version and other things asked in the template.

@atrauzzi
Copy link
Author

It's a simple enough question, consider this question applicable to all versions of Parcel or the current, whichever bypasses the bureaucracy.

There's literally zero nuance.

@DeMoorJasper
Copy link
Member

Client side routing is supported by default?

Not entirely sure what the real bug is, unless you haven't actually tried it yet.

@atrauzzi
Copy link
Author

For multiple entrypoints?

@DeMoorJasper
Copy link
Member

Not for multiple entrypoints, at least not on Parcel 1.

In Parcel 2 it can fallback to index.html, client side routing usually only really happens for spa's and once you have multiple entrypoints you really no longer have an spa

@atrauzzi
Copy link
Author

atrauzzi commented Feb 16, 2020

That seems like an arbitrary principle.

I have multiple SPAs (login + signup, consent screens, app itself)

Could it not be possible to always serve entrypoints when they are explicitly in the path?

@DeMoorJasper
Copy link
Member

I've never seen anyone do that before but sure it's possible

@atrauzzi
Copy link
Author

Well, currently it's not as parcel won't redirect to entrypoints when there are multiple.

I don't think it's at all unusual to need this. All applications can benefit from reusing the things they have in common.

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Feb 16, 2020

I meant it's technically possible and can be added to parcel not that it's currently possible without using a seperate dev server.

Anyway gonna flag this as a feature

@damianobarbati
Copy link

damianobarbati commented May 5, 2021

Not sure I'm talking about the same problem, but if I have 2 htmls:

  index.html
  admin/
       index.html

And using:

parcel src/index.html src/admin/index.html --no-cache --no-autoinstall --open

In devserver I'm only served the first index.html (bundled), to access the admin I have to go to /admin/index.html.

Current (This breaks serving 2 SPA):

  • localhost => serves index.html
  • localhost/admin => serves index.html
  • localhost/admin/index.html => serves admin/index.html

Expected:

  • localhost => serves index.html
  • localhost/admin => serves admin/index.html

Is this known and expected?

@DeMoorJasper
Copy link
Member

@damianobarbati that's probably how it should work, haven't really paid that much attention to this issue anymore as it wasn't 100% clear what the bug or actual solution is/would be.

Gonna fix that in a bit so it behaves like you mentioned. Seems fairly straightforward and simple to implement.

@damianobarbati
Copy link

damianobarbati commented May 9, 2021

I didn't want to put pressure on this, but it would be great indeed. 🙂

I'm currently working it around developing with 2 different commands (and switching every time, painful).

Thanks for the effort @DeMoorJasper 💪

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

Successfully merging a pull request may close this issue.

5 participants