我升级到babel-core 6.13.2
现在出现此错误。
/var/www/html/kalahi-rf/node_modules/babel-core/lib/transformation/file/options/option-manager.js:120
throw new TypeError(messages.get("pluginNotObject", loc, i, typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) + loc + i);
^
TypeError: Plugin 1 specified in "foreign" was expected to return an object when invoked but returned "boolean"foreign1
at Function.memoisePluginContainer (/var/www/html/kalahi-rf/node_modules/babel-core/lib/transformation/file/options/option-manager.js:120:13)
at Function.normalisePlugin (/var/www/html/kalahi-rf/node_modules/babel-core/lib/transformation/file/options/option-manager.js:141:32)
at /var/www/html/kalahi-rf/node_modules/babel-core/lib/transformation/file/options/option-manager.js:181:30
at Array.map (native)
at Function.normalisePlugins (/var/www/html/kalahi-rf/node_modules/babel-core/lib/transformation/file/options/option-manager.js:153:20)
at OptionManager.mergeOptions (/var/www/html/kalahi-rf/node_modules/babel-core/lib/transformation/file/options/option-manager.js:245:36)
at /var/www/html/kalahi-rf/node_modules/babel-core/lib/transformation/file/options/option-manager.js:254:17
at /var/www/html/kalahi-rf/node_modules/babel-core/lib/transformation/file/options/option-manager.js:342:20
at Array.map (native)
at OptionManager.resolvePresets (/var/www/html/kalahi-rf/node_modules/babel-core/lib/transformation/file/options/option-manager.js:305:20)
at OptionManager.mergeOptions (/var/www/html/kalahi-rf/node_modules/babel-core/lib/transformation/file/options/option-manager.js:253:29)
at OptionManager.init (/var/www/html/kalahi-rf/node_modules/babel-core/lib/transformation/file/options/option-manager.js:383:12)
at compile (/var/www/html/kalahi-rf/node_modules/babel-register/lib/node.js:103:45)
at loader (/var/www/html/kalahi-rf/node_modules/babel-register/lib/node.js:148:14)
at Object.require.extensions.(anonymous function) [as .js] (/var/www/html/kalahi-rf/node_modules/babel-register/lib/node.js:158:7)
at Module.load (module.js:458:32)
有人遇到错误吗?谢谢。
.babelrc
{
"plugins": ["./server/utils/babelRelayPlugin"],
"presets": ["react", "es2015", "stage-0"],
"env": {
"development": {
"plugins": [
["react-transform", {
"transforms": [{
"transform": "react-transform-hmr",
"imports": ["react"],
"locals": ["module"]
}, {
"transform": "react-transform-catch-errors",
"imports": ["react", "redbox-react"]
}]
}]
]
}
}
}
babelRelay插件
/* eslint-disable no-var, func-names, prefer-arrow-callback, global-require */
var fs = require('fs');
var path = require('path');
var jsonFile = path.join(__dirname, '../data/schema.json');
// Read the schema.json file only if it exists, this fixed
// the problem of using babelRelayPlugin, defined in .babelrc,
// and running npm run update when the file doesn't exist
fs.access(jsonFile, fs.F_OK, function (err) {
if (!err) module.exports = require('babel-relay-plugin')(require(jsonFile).data);
});