React-day-picker: Remove default exports

Created on 24 Feb 2018  路  8Comments  路  Source: gpbl/react-day-picker

Default exports was added to spec to make simple interop with commonjs and similar module systems. But for now they introduce even more mess, especially with commonjs. So I suggest just to remove them everywhere.

Without default exports this can be achieved easily

import { DayPicker, DateUtils, LocaleUtils, ModifiersUtils  } from 'react-day-picker';

or

const { DayPicker, DateUtils, LocaleUtils, ModifiersUtils  } = require('react-day-picker');

Most helpful comment

Yes, please go ahead with this! Typescript support is broken for now because of this.

Is there anyone working on this at the moment or would you accept a pull request?

All 8 comments

This is a good idea. Maybe it will help for typescript as well (asking @adidahiya)?

What mess do they introduce with commonjs? This seems like an unnecessary breaking change. There are plenty of JS library that still use default exports.

@TrySound I actually do agree with you in general about default exports (that's why I've promoted the no-default-export TSLint rule), but I don't think that's the prevailing consensus in the JS community right now and it would feel like unnecessary code churn in this project. Maybe it could eventually be bundled together with a bunch of other breaking changes, but I don't think @gpbl should treat this as an urgent priority.

@adidahiya Of course this is a case only for major release. And I think it would be better to simplify stuff in the nearest major, not any further.

Looks good to me: maintaining a default export with that named export for the Input component has given me enough headache.

Yes, please go ahead with this! Typescript support is broken for now because of this.

Is there anyone working on this at the moment or would you accept a pull request?

This will is already implemented in the upcoming mayor version, closing.

Was this page helpful?
0 / 5 - 0 ratings