New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New babel update breaks sequelize imports #4881
Labels
Comments
That would probably be a fine fix. You are probably most equipped to attempt a fix since you are running ES6 in your environment, PR welcome :) |
alexschneider
added a commit
to alexschneider/sequelize
that referenced
this issue
Nov 19, 2015
alexschneider
added a commit
to alexschneider/sequelize
that referenced
this issue
Dec 4, 2015
Fix tests and description based on feedback
mickhansen
added a commit
that referenced
this issue
Dec 4, 2015
Fix #4881 and add tests for es6 imports
Hi, is there a npm release with babel 6 support out there already? |
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 asrequire('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 (addingmodule.exports = exports["default"];
to the end of your model).Is there any way sequelize can check for
require(path).default
for thedefineCall
function? Something likedefineCall = defineCall.default || defineCall;
orif (typeof defineCall === 'object' && defineCall.default) { defineCall = defineCall.default; }
?The text was updated successfully, but these errors were encountered: