So I have this simple module:
export default function(){}
if I don't use export default
, then the TypeScript compiler will write one warning saying my "module has no default export", which I'd like to avoid.
So to use this module, we would do:
import fn from 'my-module';
that's all good and well, 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 pretty awkward for users. Is there any way around this?