2016-10-03 8 views
1

베타 11에서 rc0으로 내 ionic app를 업데이트했습니다. 그래서 그것은 angular2 rc4에서 angular2 stable로, typescript 1.8에서 2로 그리고 rollupjs 모듈 bundler를 사용하여 전환했다는 것을 의미합니다.파이어베이스 ionic2-rc0 및 롤업 - "롤업 : 'eval` 사용을 강력하게 권장하지 않습니다."

나는이 블로그 게시물에 따라 AngularFire2 구성한 : Getting Started with Ionic 2 RC0, Firebase 3 + AngularFire 2

내가 컴파일 할 수 아니에요이 오류 점점 :

rollup: Use ofeval(in c:\XXX\node_modules\angularfire2\node_modules\firebase\firebase.js) is strongly discouraged, as it poses security risks and may cause issues with minification. See https://github.com/rollup/rollup/wiki/Troubleshooting#avoiding-eval for more details

사람이 진행하는 방법이 문제를 해결하는 방법 무엇을 알겠습니까?

답변

1

장기적으로, 해결책은 Firebase가 해당 코드에서 직접 eval을 제거하는 것입니다. 실제로는 필요하지 않습니다 (단지 JSON을 구문 분석하는 데 사용됩니다.) JSON.parse은 훨씬 빠르며 기본적으로 지원되지 않습니다 일). 한편

, A (해키이기는하지만) 가능한 해결 방법은 간접 eval rollup-plugin-replace 사용 (차이를 이해하기 위해 troubleshooting note 참조)에 그 eval을 변환 할 수 있습니다 :

// rollup.config.js 
import nodeResolve from 'rollup-plugin-node-resolve'; 
import commonjs from 'rollup-plugin-commonjs'; 
import replace from 'rollup-plugin-replace'; 
// ...etc 

export default { 
    // ...other config... 
    plugins: [ 
    nodeResolve({...}), 
    commonjs({...}), 
    replace({ 
     include: 'node_modules/firebase/firebase.js', 
     values: { 
     'eval(' : '[eval][0](' 
     } 
    }) 
    ] 
}; 
+0

답장을 보내 주셔서 감사합니다. 다른 곳에서는 좀 더 심각한 오류가 있다고 생각합니다. 그래서 내가 컴파일 할 수 없습니다. eval을 사용하는 것은 심각한 오류가 아니므로 그대로 유지할 것이라고 생각합니다. 다시 한 번 감사드립니다. – Dee

2

당신은 비활성화 할 수 있습니다 이 경고 롤업 설정 :

// rollup.config.js 

export default { 
    // ...other config... 
    onwarn: function (message) { 
    if (/Use of `eval` \(in .*\/node_modules\/firebase\/.*\) is strongly discouraged/.test(message)) { 
     return; 
    } 
    console.error(message); 
    } 
};