-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New babel update breaks sequelize imports #4881
Description
The recent babel 6 update caused models written in es6 to fail to import. The reason being is because Babel killed support for CommonJS's default export behavior (default export behavior is if the default export is the only export in a file, module.exports = exports["default"];). Since babel doesn't do this anymore, the default export is only available as require('modulename').default.
Since sequelize does a require when you import a model, it is impossible to import a model transformed by babel without a hack (adding module.exports = exports["default"]; to the end of your model).
Is there any way sequelize can check for require(path).default for the defineCall function? Something like defineCall = defineCall.default || defineCall; or if (typeof defineCall === 'object' && defineCall.default) { defineCall = defineCall.default; }?