2016-09-07 16 views
3

私はAurelia CLI(typescript)アプリにdhtmlxschedulerをインストールしようとしています。私はNPMそれをインストールしている: dhtmlxscheduler with Aurelia and typescript

npm i dhtmlx-scheduler 

は、その後、私は aurelia.jsonファイルにこれを追加しました:

{ 
    "name": "dhtmlx-scheduler", 
    "path": "../node_modules/dhtmlx-scheduler/codebase", 
    "main": "dhtmlxscheduler" 
}, 

そして、それのためのグローバルなタイピング作成:

typings install dt~dhtmlxscheduler --global --save 

すべてがインストールされ、au runコンパイルを正しく私はそうのようにそれをインポートしています

error TS2307: Cannot find module 'dhtmlxscheduler'. 
[02:00:15] gulp-notify: [Error running Gulp] Error: src/components/appointments/appointments.ts(2,20): error TS2307: Cannot find module 'dhtmlxscheduler'. 

:私は、私はこのエラーを取得するのに実際にライブラリを使用しようとすると

import * as scheduler from 'dhtmlxscheduler'; 
+0

「dhtmlxscheduler」からスケジューラとして 'インポート*を変更してみてください;'輸入 'へ* 'dhtmlx-scheduler'のスケジューラーとして; Aurelia CLI Github [page](https://github.com/aurelia/cli#user-content-a-single-file-module)は、 "name"に与えられた値はインポートで使用された値と同じでなければならないと述べています。 –

答えて

0

は私がdhtmlxscheduler.jsに見て、それがどんなexportしませんメンバーのプロパティimport * as scheduler from 'dhtmlxscheduler';を実行するとエラーが発生します。

代わりに、importモジュール全体:

import 'dhtmlx-scheduler'; // Taking into account the comment that I left above 

次に、あなたがあなたのクラスで直接scheduler関数を呼び出すことができます。

1

@Robinson Colladoのインポートステートメントで動作します。あなたは、リソースとしてdhtmlx・ガントのCSSファイルを追加する必要があります

{ 
    "name": "dhtmlx-gantt", 
    "path": "../node_modules/dhtmlx-gantt/codebase", 
    "main": "dhtmlxgantt", 
    "resources": [ 
    "dhtmlxgantt.css" 
    ] 
} 

をして、テンプレートに含める:

<require from="dhtmlx-gantt/dhtmlxgantt.css"></require>