我已将我的离子应用从beta 11更新为rc0。所以这意味着我已经从angular2 rc4切换到angular2 stable,从typescript 1.8切换到2并使用rollupjs模块捆绑器。
我根据这篇博客文章配置了AngularFire2: Getting Started with Ionic 2 RC0, Firebase 3 + AngularFire 2
我无法编译并收到此错误:
汇总:使用ofeval(in c:\ XXX \ node_modules \ angularfire2 \ node_modules \ firebase \ firebase.js)是 强烈劝阻,因为它带来安全风险并可能导致问题 缩小。看到 https://github.com/rollup/rollup/wiki/Troubleshooting#avoiding-eval 了解更多详情
任何人都知道发生了什么以及如何解决这个问题?
答案 0 :(得分:1)
长期以来,Firebase的解决方案是从代码中删除直接eval
,因为这里实际上并不需要(它只是用于解析JSON。JSON.parse
更快,并且支持这些天基本上不是问题。)
与此同时,一种可能的(虽然是hacky)解决方法可能是将eval
转换为间接 eval
(请参阅troubleshooting note以了解差异),使用rollup-plugin-replace:
// 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]('
}
})
]
};