2017-07-29 18 views
1

UMDにコンパイルされたライブラリ(Tus.io)があります。私はAngular2/4プロジェクトでそれを必要としています。私はNPMとそれをインストールするとき(NPMはTUS-JS-クライアントインストール)し、それをインポート(するvar TUS =( "TUS-JS-クライアント")が必要です。を)私が手にエラーがある:角度2/4のUMDライブラリを使用

Failed to compile. 
/home/***/src/app/manageVideos/Partials/add.component.ts (8,17): 
Module '../../../../node_modules/tus-js-client/dist/tus.js' 
was resolved to '/home/***/node_modules/tus-js-client/dist/tus.js', 
but '--allowJs' is not set. 
/home/***/src/app/manageVideos/Partials/add.component.ts (9,11): Cannot find name 'require'. 

答えて

1

あなたの問題への最も簡単な解決策は、活字体の宣言をインストールするには、次のとおりです。

npm install @types/tus-js-client --save-dev 

そして、このようにそれをインポートする:

import * as tus from "tus-js-client"; 
関連する問題