This question already has an answer here:
- Is there any one-line analogy in ES6 for ES5 `module.exports = require('./inner.js')`? 1 answer
I want to export some module like below way but always failed..
foo.js
const foo = {
a: 'b'
};
export default foo;
index.js
export foo from './foo'; // encounter error here
export * from './foo'; // it works..
I don't know why can't I use the first method to export module from foo.js
, in my opinion, I can export anything like func, class, variables etc..