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
[Question] Export, import modules #625
Comments
You could use // package.json
}
"dependencies": {
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.24.1",
...
} // .babelrc
{
"presets": ["es2015"]
} // index.js < main entry point
require('babel-register');
require('./server').run(); // server.js < your actual code here
import express from 'express';
export const run () => {
const app = express()
......
} Or you could simply transpile the code using |
The generated application will always only use what the latest version of Node supports (we'll probably update it to use In summary, using ES modules with Babel will increase startup/compile time and possibly memory consumption just to use a spec whose implementation details (especially for Node) have not been fully finalized. If you still want to use it, you can probably run the generated code through a require to ES module tranformer with the Babel setup that @zusamann pointed out. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs. |
Currently, my project base on feather-cli and i need to use import, export module instead of
require
But i got the error
SyntaxError: Unexpected token export
when i try to use import, export.I saw some issue make feather turn back into commonjs.
I understand after #608 approve and merged, i can use import, export without error.
So my question is what can i do to use import & export instead of
require
?The text was updated successfully, but these errors were encountered: