[英]what's wrong with my angular2 import code
如下面的代碼,我是angular2的新手,為什么當我使用“ app / app.module”時,燈光服務器返回錯誤:
import {AppModule} from "app/app.module";//wrong
import {AppModule} from "./app.module"; //right
app / main.ts(5,25):錯誤TS2307:找不到模塊“ /app/app.module”。
有什么問題?有沒有辦法使用"app/app.module"
?
我認為問題是由於tsconfig.json從角度2 tut。 但我不知道如何解決。
謝謝大家
AppModule的路徑是相對於您當前文件的。
如果使用Webpack或SystemJS導入,則應遵循此約束
AppModule _> same folder
./AppModule -> inside a file
../AppModule -> go out from current directory
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.