As code Below, Im new to angular2, why when i use "app/app.module" the light server returns an error:
import {AppModule} from "app/app.module";//wrong
import {AppModule} from "./app.module"; //right
app/main.ts(5,25): error TS2307: Cannot find module '/app/app.module'.
what's the problem?is there any way to use "app/app.module"
?
this is the structure image, exactly flow the angular 2 tut.
I think the problem is because of tsconfig.json, from angular 2 tut. but I dont know how to fix it.
thanks everybody
The path of the AppModule is relative to your current file.
If you using Webpack or SystemJS to import, you should follow this constraint
AppModule _> same folder
./AppModule -> inside a file
../AppModule -> go out from current directory
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.