So, I have this simple module:
export default function(){}
If I do not use export default , then the TypeScript compiler will write one warning that my “module has no default export”, which I would like to avoid.
So, to use this module, we would do:
import fn from 'my-module';
that everything is good and good, but what if I want to use CommonJS to import it?
Then I have to do this:
const fn = require('my-module').default;
This is rather inconvenient for users. Is there any way around this?
source share