2016-06-29 2 views
0

PouchDB 인증 라이브러리 (https://github.com/nolanlawson/pouchdb-authentication)를 Angular2 Cli Typescript 프로젝트로 가져 오는 데 문제가 있습니다.Angular2 Cli 프로젝트의 PouchDB 인증 라이브러리

내 typings이 추가되었습니다 :

declare module "pouchdb-authentication" {} 

system-config.ts 파일 map에 포함

'pouchdb-authentication': 'vendor/pouchdb-authentication/dist/', 

packages에 :

"pouchdb-authentication": { 
    main: "pouchdb.authentication.js", 
    defaultExtension: "js" 
}, 

내가 그것을 사용하려고 시도하고있다 이렇게 :

PouchDB.plugin(require('pouchdb-authentication')); 

나는 또한 시도 :

import * as PouchDBAuthentication from 'pouchdb-authentication'; 

현재, 내 콘솔에서이 오류를 얻고있다 :

zone.js:461: Unhandled Promise rejection: (SystemJS) TypeError: AMD module http://localhost:4200/vendor/pouchdb-authentication/dist/pouchdb.authentication.js did not define

어떤 아이디어가 많이 주시면 감사하겠습니다! 고맙습니다!

답변

2

CommonJS 패키지를 사용하는 대신 dist/pouchdb.authentication.js을 가져 오시겠습니까? dist/에는 UMD 패키지가 포함되어 있습니다.이 경우 SystemJS가 AMD로로드하려고 시도하는 것처럼 보입니다.

편집 : 신경 쓰지 마라, UMD로 제작하는 것을 잊어 버렸다. 이 문제를 해결 한 다음 dist/을 사용할 수 있어야합니다 (SystemJS가 CommonJS를 잘 사용할 수 있어야하므로 다시는 필요하지 않겠지 만).

여기에 문제를 개관 : https://github.com/nolanlawson/pouchdb-authentication/issues/103

편집 : pouchdb 인증 0.5.2에서 수정을 다시 시도하십시오

+1

감사합니다! 그것은 그것을 고쳤다! – Josiah

관련 문제