How to re-export a named import as default in JavaScript?
Tried this but it doesn't seem to work:
import { MyFunc } from './MyModule';
export default MyFunc;
I get an error:
Attempted import error: 'MyFunc' is not exported from 'MyModule'.
The above works:
import { MyFunc } from './MyModule';
export default MyFunc;
My mistake was trying to import from index.js as a named import.
Another way that seems to work is:
export { MyFunc as default } from './MyModule';