Firebase ionic2 和汇总 - “汇总:强烈建议不要使用 `eval`”
Firebase ionic2 and rollup - “rollup: Use of `eval` is strongly discouraged”
我已经根据这个博客post配置了AngularFire2:ionic 2 firebase
我遇到了这个错误
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
这是我的源代码
console.log("I'm the Hulk");// for test
var nodeResolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs');
var globals = require('rollup-plugin-node-globals');
var builtins = require('rollup-plugin-node-builtins');
var json = require('rollup-plugin-json');
// https://github.com/rollup/rollup/wiki/JavaScript-API
var rollupConfig = {
/**
* entry: The bundle's starting point. This file will
* be included, along with the minimum necessary code
* from its dependencies
*/
entry: 'src/app/main.dev.ts',
/**
* sourceMap: If true, a separate sourcemap file will
* be created.
*/
sourceMap: true,
/**
* format: The format of the generated bundle
*/
format: 'iife',
/**
* dest: the output filename for the bundle in the buildDir
*/
dest: 'main.js',
useStrict: false,
/**
* plugins: Array of plugin objects, or a single plugin object.
* See https://github.com/rollup/rollup/wiki/Plugins for more info.
*/
plugins: [
builtins(),
commonjs({
include: [
'node_modules/rxjs/**', // firebase needs rxjs to avoid build errors
'node_modules/firebase/**', // here we're calling firebase.
'node_modules/angularfire2/**' // here we're calling angularfire2.
],
namedExports: {
'node_modules/firebase/firebase.js': ['initializeApp', 'auth', 'database'],
'node_modules/angularfire2/node_modules/firebase/firebase-browser.js': ['initializeApp', 'auth', 'database']
}
}),
nodeResolve({
module: true,
jsnext: true,
main: true,
browser: true,
extensions: ['.js']
}),
globals(),
json()
]
};
if (process.env.IONIC_ENV == 'prod') {
// production mode
rollupConfig.entry = '{{TMP}}/app/main.prod.ts';
rollupConfig.sourceMap = false;
}
module.exports = rollupConfig;
是的,在终端上出现错误很烦人,但这并没有阻止 Ionic 构建 .js
文件。
我已经根据这个博客post配置了AngularFire2:ionic 2 firebase
我遇到了这个错误
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
这是我的源代码
console.log("I'm the Hulk");// for test
var nodeResolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs');
var globals = require('rollup-plugin-node-globals');
var builtins = require('rollup-plugin-node-builtins');
var json = require('rollup-plugin-json');
// https://github.com/rollup/rollup/wiki/JavaScript-API
var rollupConfig = {
/**
* entry: The bundle's starting point. This file will
* be included, along with the minimum necessary code
* from its dependencies
*/
entry: 'src/app/main.dev.ts',
/**
* sourceMap: If true, a separate sourcemap file will
* be created.
*/
sourceMap: true,
/**
* format: The format of the generated bundle
*/
format: 'iife',
/**
* dest: the output filename for the bundle in the buildDir
*/
dest: 'main.js',
useStrict: false,
/**
* plugins: Array of plugin objects, or a single plugin object.
* See https://github.com/rollup/rollup/wiki/Plugins for more info.
*/
plugins: [
builtins(),
commonjs({
include: [
'node_modules/rxjs/**', // firebase needs rxjs to avoid build errors
'node_modules/firebase/**', // here we're calling firebase.
'node_modules/angularfire2/**' // here we're calling angularfire2.
],
namedExports: {
'node_modules/firebase/firebase.js': ['initializeApp', 'auth', 'database'],
'node_modules/angularfire2/node_modules/firebase/firebase-browser.js': ['initializeApp', 'auth', 'database']
}
}),
nodeResolve({
module: true,
jsnext: true,
main: true,
browser: true,
extensions: ['.js']
}),
globals(),
json()
]
};
if (process.env.IONIC_ENV == 'prod') {
// production mode
rollupConfig.entry = '{{TMP}}/app/main.prod.ts';
rollupConfig.sourceMap = false;
}
module.exports = rollupConfig;
是的,在终端上出现错误很烦人,但这并没有阻止 Ionic 构建 .js
文件。