I have a project with Angular 6, Typescript, webpack 4.
I want to use alias in webpack in order to make my import statement clearer.
This is the code I have in webpack:
resolve: {
alias: {
assets: `${helpers.root('src/assets/')}`,
app: `${helpers.root('src/app/')}`
},
}
The "assets" alias is working fine !
I use the "app" alias in this way within the code of a component:
import { UtilsService } from 'app/_services/utils.service';
And this is the constructor of the component:
constructor( @Inject( UtilsService ) private utils: UtilsService, ) {
}
I don't have an error on the import statement, so I guess that the alias works in some way.
But I have the following error in the constructor:
TS2709: Cannot use namespace 'UtilsService' as a type.
I must be missing some configuration somewhere but can't figure out what ?
Any help will be greatly appreciated
from Webpack alias with Angular - Cannot use namespace 'UtilsService' as a type
No comments:
Post a Comment