Greentube / localize-router

An implementation of routes localisation for Angular
MIT License
192 stars 93 forks source link

Unhandled promise rejection #167

Open BruneXX opened 4 years ago

BruneXX commented 4 years ago

I'm submitting a ... (check one with "x")

[x ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if similar feature request does not exist
[ ] support request => Suggested place for help and support is [stackoverflow](https://stackoverflow.com/), search for similar question before posting

Description

I've downloaded the demo of localized-router to check the configuration, I've reviewed a lot and after my configuration I'm receiving this error:

zone-evergreen.js:659 Unhandled Promise rejection: Class constructor SystemJsNgModuleLoader cannot be invoked without 'new' ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Class constructor SystemJsNgModuleLoader cannot be invoked without 'new'
    at new LocalizeRouterConfigLoader (localize-router-config-loader.js:22)

I saw that in demo you're using angular 6 could this be an issue related to angular 8? thanks

🌍 Your Environment

Angular Version: 8.2.5

Localize Router Version: 2.0.0-RC.3

BruneXX commented 4 years ago

Hi new update:

I've managed to solve this, but now I'm experiencing no errors on compílation, but when I'm trying to access to the app I'm receiving the following error in the node console..

ERROR [Error]

So that's all.. there's no error description just that, any ideas what can be happening here?

BruneXX commented 4 years ago

well, I went a little further and found that it seems to be a problem with createTranslateLoader funciton but I'm not 100% sure, I've reviewed an old angular repo https://github.com/gilsdav/angular-universal-localize-router

and there's seems to be using a ManualParserLoader that apparently works.. so at least the app is up and running using that loader instead of the createTranslateLoader

If someone have a clue on this will be really appreciated since the localize-router documentation is not so clear how should be implemented in the universal apps..

Tyranwyn commented 4 years ago

I'm having the same problem when accessing localhost:4200.

TypeError: Class constructor SystemJsNgModuleLoader cannot be invoked without 'new' at new LocalizeRouterConfigLoader (:4200/vendor.js:176186) at _createClass (:4200/vendor.js:91249) at createProviderInstance (:4200/vendor.js:91210) at initNgModule (:4200/vendor.js:91116) at new NgModuleRef (:4200/vendor.js:92226) at createNgModuleRef (:4200/vendor.js:92209) at Object.debugCreateNgModuleRef [as createNgModuleRef] (:4200/vendor.js:104419) at NgModuleFactory_.create (:4200/vendor.js:105552) at :4200/vendor.js:100252 at ZoneDelegate.invoke (:4200/polyfills.js:10931)

LocalizeRouterModule.forRoot(routes, {
      parser: {
        provide: LocalizeParser,
        useFactory: (translate, location, settings, http) =>
          new LocalizeRouterHttpLoader(translate, location, settings, http),
        deps: [TranslateService, Location, LocalizeRouterSettings, HttpClient]
      }
    })
Tyranwyn commented 4 years ago

so, changing tsconfig.json target from esnext to es5 and module to es2015 fixed it for me.

BruneXX commented 4 years ago

Hi @Tyranwyn are you using Angular Universal too?

Tyranwyn commented 4 years ago

No I am not