Плагин Babel 5 (объект-назначение) запускается вместе с Babel 6
После обновления зависимостей проекта я начал видеть эту ошибку, кажется, есть проблема с версионированием object-assign
Вавилон 5 плагин.
После обновления я использую Babel 6, ближайший плагин, который я смог найти, это es6-object-assign
, но его использование приводит к ошибке (ошибка показана ниже).
Использование browserify
+ babelify
+ object-assign
в моем приложении:
var babelify = require('babelify');
var browserify = require('browserify-middleware');
var keystone = require('keystone');
var importRoutes = keystone.importer(__dirname);
// Setup Route Bindings
exports = module.exports = function(app) {
app.use('/js', browserify('./client/scripts', {
transform: [babelify.configure({
plugins: ['object-assign']
})]
}));
// Views
app.use(function(req, res) {
res.render('index');
});
};
Журнал сервера:
GET / 304 260.457 ms
Error thrown for request: /js/Application.js
Error: The (object-assign) Babel 5 plugin is being run with Babel 6. while parsing file: /home/user/project/client/scripts/Application.js
at new Plugin (/home/user/project/node_modules/babel-core/lib/api/node.js:96:9)
at exports.default (/home/user/project/node_modules/babel-plugin-object-assign/lib/index.js:11:10)
at Function.memoisePluginContainer (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:109:13)
at Function.normalisePlugin (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:142:32)
at /home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:30
at Array.map (native)
at Function.normalisePlugins (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:154:20)
at OptionManager.mergeOptions (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:36)
at OptionManager.init (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:374:12)
at File.initOptions (/home/user/project/node_modules/babel-core/lib/transformation/file/index.js:216:65)
at new File (/home/user/project/node_modules/babel-core/lib/transformation/file/index.js:139:24)
at Pipeline.transform (/home/user/project/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at Babelify._flush (/home/user/project/node_modules/babelify/index.js:27:24)
at Babelify.<anonymous> (_stream_transform.js:118:12)
at Babelify.g (events.js:291:16)
at emitNone (events.js:86:13)
Ошибка при переходе на plugins: ['es6-object-assign']
наверное потому что babelify требует оригинала object-assign
пакет в node_modules/babelify/index.js
онлайн var assign = require("object-assign");
:
GET / 304 280.365 ms
Error thrown for request: /js/Application.js
Error: Plugin 0 specified in "base" provided an invalid property of "assign" while parsing file: /home/user/project/client/scripts/Application.js
at Plugin.init (/home/user/project/node_modules/babel-core/lib/transformation/plugin.js:131:13)
at Function.normalisePlugin (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:148:12)
at /home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:30
at Array.map (native)
at Function.normalisePlugins (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:154:20)
at OptionManager.mergeOptions (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:36)
at OptionManager.init (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:374:12)
at File.initOptions (/home/user/project/node_modules/babel-core/lib/transformation/file/index.js:216:65)
at new File (/home/user/project/node_modules/babel-core/lib/transformation/file/index.js:139:24)
at Pipeline.transform (/home/user/project/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at Babelify._flush (/home/user/project/node_modules/babelify/index.js:27:24)
at Babelify.<anonymous> (_stream_transform.js:118:12)
at Babelify.g (events.js:291:16)
at emitNone (events.js:86:13)
at Babelify.emit (events.js:185:7)
at prefinish (_stream_writable.js:478:12)