generator-gulp-angular
generator-gulp-angular copied to clipboard
Standard TS file reference doesn't seam to work
When generator-gulp-angular moved to ES6 modules does such reference at the begging of TS is still valid:
reference path="some other ts file"
I cannot make the application to work when I use my references... Is internal module TS concept (http://www.typescriptlang.org/Handbook#modules-splitting-across-files) still supported with current configuration with ES6 modules?
+1
When I made the move, I didn't succeed importing the typings with an ES6 import. The TS reference notations worked in the other hand. Does it stopped working out of the box? It could be possible if a TS version upgrade deprecates the reference notation...
OK so there are two issues
- References stopped working out of the box. I do not suppose that TypeScript 1.6.2 which is now in the project deprecates them. According to TS documentation they are fully backward compatible with this. For sure this worked for generator prior to version 1.0.0.
- That's true that after adding ES6 import typings work in a very strange manner. For example they work fine when I import modules into index.module.ts.
This in index.module.ts works perfectly: import { RouterConfig as GsRouterConfig } from './modules/gs/routing';
./modules/gs/routing.ts has standard dependencies:
export function RouterConfig($stateProvider:ng.ui.IStateProvider, $urlRouterProvider:ng.ui.IUrlRouterProvider) {
But on the other hand when in index.module.ts I import some other module like this:
import trades from './modules/trades/trades';
And in ./modules/trades/trades.ts I import exactly the same /modules/gs/routing like this import { RouterConfig as GsRouterConfig } from './routing';
It gives me the following error when I launch the application: Uncaught Error: [$injector:modulerr] Failed to instantiate module gsWebDetailsPanel due to: Error: [$injector:modulerr] Failed to instantiate module trades due to: Error: [$injector:unpr] Unknown provider: $stateProvider
TS compiles fine though... any ideas?
That doesn't look like a TS error. It looks like a Angular's dependency injection error. It fails to find a $state service. Did you load ui router (script and module) well?
I know it's Angular dep injection error, but please read all the above. There is one case in which dependency works and one in which it doesn't. I described in details above.
Thanks!
Ok sorry, don't you want a relative path in this import ? import { RouterConfig as GsRouterConfig } from 'routing'; -> import { RouterConfig as GsRouterConfig } from './routing';
As it is, it will search for a lib routing.
There was a typo above, I'm using: import { RouterConfig as GsRouterConfig } from './routing';
arf ^^
With the failing version, there is any error in the console during the TS compilation?
Unfortunately there isn't. It's so problematic because TS compilation ends with success and the application fails to start with the above error in console.