-
Notifications
You must be signed in to change notification settings - Fork 192
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
Possible to not need @angular/router when using @uirouter? #393
Comments
Are you sure this is adding it to the bundle? |
@scttcper Yes, we started using this bundle-stats plugin (https://github.com/relative-ci/bundle-stats/) to monitor how the webpack bundle changes in our app with each code change. I tried removing
Here's the relevant section from the bundle-stats report showing that I tried adding a webpack ignore plugin entry to prevent the module from being added to the bundle, which did do just that, but then the app won't run: We're currently on Angular 8.2 (working our way up slowly) and version 8.3.0 of this module. The module is being loaded like so: import { Angulartics2UirouterModule } from 'angulartics2/uiroutermodule'; From what I can tell, this line in import { ANGULARTICS2_TOKEN, RouterlessTracking, Angulartics2, Angulartics2OnModule } from 'angulartics2'; includes import { NavigationEnd, Router } from '@angular/router'; Technically the bit of code that uses those two imports from Let me know if there's any other details you'd like me to provide. Thanks! |
It's possible that the Terser plugin in our production build would tree-shake that out, I'm trying to confirm that (the stats above are from the development build, which doesn't minify). |
It does appear that the From "Debugger" tab in Firefox (sourcemaps): I looked in the Which match these in /**
* A [DI token](guide/glossary/#di-token) for the router service.
*
* @publicApi
*/
var ROUTER_CONFIGURATION = new InjectionToken('ROUTER_CONFIGURATION');
/**
* @docsNotRequired
*/
var ROUTER_FORROOT_GUARD = new InjectionToken('ROUTER_FORROOT_GUARD'); |
Thanks for digging into it, something to look into. Honestly, you seem to be on top of your angular app. I think you'll only be disappointed by using angulartics2 and you should roll your own smaller custom solution. It can start as simple as a service at the root level of the app the subscribes to router events. |
@scttcper thanks for the reply. We're migrating an AngularJS app to Angular and this lib came up as a good replacement for the |
I'm submitting a ...
bug report
feature request
question about the decisions made in the repository
What is the motivation / use case for changing the behavior?
We're using this module with UIRouter and don't use the Angular router in our app. According to the docs for this module
@angular/router
is required to be installed but it "won't be used".https://github.com/angulartics/angulartics2#using-with-ui-router
Unfortunately this ends up adding
@angular/router
to our webpack bundle, which is many kbs of unnecessary code. Is it possible to remove the dependency on@angular/router
when a different router is used?The text was updated successfully, but these errors were encountered: