example-node-server icon indicating copy to clipboard operation
example-node-server copied to clipboard

It does not resolve import/export

Open uaNikita opened this issue 7 years ago • 1 comments

Hi, thanks for you example.

I have a question. When I added my additional module via

import test from './test.jsx';

with content

export default 1;

babel compile it to

var _test = require('./test');

var _test2 = _interopRequireDefault(_test);

and it does not work because node does not understand export default 1;.

Babel somehow resolve dependencies for production? Or I should use webpack for example?

uaNikita avatar Apr 05 '17 08:04 uaNikita

See: https://babeljs.io/docs/usage/cli/

ES6-style module-loading may not function as expected Due to technical limitations ES6-style module-loading is not fully supported in a babel-node REPL.

santimendoza avatar Oct 13 '17 13:10 santimendoza