I have new angular cli project that created using ng new and i extract the webpack configuration using ng eject.
So now i have an external es6 module and i want to use it inside one of my components.
Let us assume the project structure like this:
src\app\customModule
this folder has two files myModule.ts
, myModule2.ts
.
I have create new entry point and chunk for this module and call it customeModule
and make sure it downloaded before the main chunk.
Here is myModule.ts
file:
module MyModule{
export interface CarProperties {
name:string;
price:number;
}
export enum CarType{
BMW,
Hyundai
}
}
And myModule2.ts
file:
module MyModule{
export class Car {
private speed:number;
constructor(){
console.log("New car has been initialized");
}
}
}
So Assume i will use it in app.component.ts:
ngOnInit(){
console.log(MyModule);
}
Once i run npm run start or npm run build, i saw the new chunk with the network tab but still get MyModule is undefined
Any suggestions ? Thanks in advance :)