-
Notifications
You must be signed in to change notification settings - Fork 304
Support path based routing in dev-server #916
Conversation
Awesome! This is exactly what the doctor ordered. I second this motion. Thanks for submitting this! Hoping to see it get merged soon. |
Confirmed this patch works for me with no issues. |
WOW 😳 Adding support for path location strategy in just one line is awesome. BTW, it should be It doesn't even need to add the slashes to the tags in @danbucholtz please consider merging/adding this one-liner. |
How does this work with the deep linker? Sorry, I have so much going on I haven't had a chance to take a look. @FdezRomero, does this break anything? Working well for you? Thanks, |
The only thing preventing people from using Adding It's a server-side thing, so the deep linker is not affected. This line doesn't break anything and works well. The changes in Thanks, |
I added this so that I could use the deep linker locally. Without this patch, your local dev server will fail to resolve /anything/ and throw 404s everywhere if you've navigated anywhere in the app besides the root component. I'd say it works fine. I haven't run into any issues with it, but I did get tired of hacking it every time new app scripts came out, so I used environments to work around it for the time being. Would still love this so I can actually debug my apps using production-like URLs. |
@antriver, want to remove the injector changes? Sounds like we can merge the other part. I haven't tested yet but I will. Thanks, |
@FdezRomero |
@subhash-ztech They're not related. In this case, because we are serving |
@FdezRomero Thanks for the clarification. |
Testing on the 2.0.0 release I noticed that @antriver was right about his Apologies for my mistake @danbucholtz, commit df1583e needs to be reverted and slashes to be added 🙏 |
Hi @danbucholtz , Could you explain what this broke? In 065912e you say it "broke proxies". Can you elaborate on that so I can fix this if necessary and we can actually get it released. Also, as mentioned above, the injector changes are needed. Otherwise |
I don't know the details but people that need to run Thanks, |
Is this something that can be added as a flag? To allow the developers who do need this functionality? Or, are there any other solutions which I am missing regarding this issue? |
If the base href tag is put higher in the html file than the injected scripts, one does not need to prepend slashes. This is what I do - my index.html file has the base as the third thing: |
Although this pull request is merge but I am unable to find these changes in here in http-server.ts. I set up an Ionic App (ionic version 3.20.0) with path location strategy. I had the same issue. I investaged and reached here and found that the changes in this pull request are missing in my node modules (in node_modules/@ionic/app-scripts/dist/dev-server/http-server.js). |
Short description of what this resolves:
Assuming you wish to use the path location strategy in the Ionic app
and are running
ionic serve
.Currently you can load your index page and navigate around fine. The path in the browser is updated to
/about
for example. However if you refresh this/about
page, you get a 404 because that path does not exist.Changes proposed in this pull request:
Added a catchall route so that 404 will get sent to the index page and the Ionic deeplinker can handle routing to the
about
segment.