-
Notifications
You must be signed in to change notification settings - Fork 210
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
Support deep linking in the dev server without hash location strategy #886
Comments
Personally I don't think this is something we should bake in, we should just provide the capabilities to add it yourself. That provides more value in the long term and will also help us have fewer breaking changes. Other packages should be able to wrap up most of the logic, so for instance angular_router should be able to expose a handler to deal with its way of doing routing, and it should be trivial for users to add that in. Or possibly we could even allow packages to inject handlers into the dev server automagically through build.yaml config. |
This is probably the easiest route for for now. |
It would be awesome if this were modular, configurable with build.yaml, and something that the Angular package could have a hand it - I wonder how quickly we can do that and how many people will be forced onto the manual path in the meantime. I think it would be relatively straightforward to implement behind a command line flag in the short term - if we can turn around quickly with it, is there any reason we shouldn't? |
@natebosch I don't want to get stuck with it forever and don't want to support all the custom options people ultimately would want for it. I think we could run almost as quickly on a really simple solution that allows you to inject handlers? I also think people would be super happy with a completely manual process, as long as they had some option which they don't have today. |
Maybe we just need a way to write a "serve.dart", i.e. let |
#888 would be one way to make it easier to let build_runner take care of the reading the config for angular/build_web_compilers but then letting the user handle the rest - including doing custom stuff with the handler. |
Yes, we have talked offline a bit about this in the past but one of the simplest options would be to enable users to create handlers in a dart file and either have those be imported by the main script and added to the cascade or possibly just allow you to return a completely custom cascade or server. This could be done either by convention |
(This would be great for running the AngularDart examples.) |
Any work on this? We love Here's a quick hack to support a minimal deep-linking that we put together. In https://github.com/dart-lang/build/blob/master/build_runner/lib/src/server/server.dart around line 321 we added a few lines of code to
Of course proper support would include command line option processing and/or other implementations as discussed above. However, we were pleasantly surprised by how the Dart build system allowed us to use the above hack - download this repository, make the above changes, then in our main application's |
Nothing yet - and I don't think we have any plans scheduled to properly fix it. We would however be receptive to pull requests, but it would be a good idea to have us review your general design before writing any code to reduce churn if you decide to go that route. I still think the best solution would be a general mechanism for adding custom handlers, but we would be open to alternate proposals including but not limited to a custom flag that enables behavior similar to what you have above (I wouldn't be in favor of that as the default behavior though). It would probably need to be customizable as far as which page is served, and maybe only handle directory paths?
That is one of the primary reasons this project doesn't live in the SDK :) , it definitely makes it easier to add custom hacks around things. Note that you will introduce a bit of extra startup time here - pub disables snapshotting of path dependencies executables, but that is probably an acceptable price to pay. |
Should this be moved to webdev given that the serve command is planned for removal here? (#2227) Has any more discussion been had around doing this via build.yaml config versus a convention like |
we've created a PR that add an option to redirect not found to a specific asset: #3361 it should fix this issue |
I think this is usually done by searching upwards for an
index.html
instead of serving a 404.Hopefully we can make this an option with our handler. Otherwise we should document how to get your own handler to do this.
The text was updated successfully, but these errors were encountered: