insin / insin/react-maskedinput

Exports between the lib and es module differ.

Open
#104 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
727
Forks
191
PR merge metrics
No merged PRs in 30d

Description

Hey There,

In the project I'm using this in I've come across an interesting scenario. When node compiles and renders the page, it uses the `lib` version, and when webpack compiles the browser version, it uses the `es` module. Now, this seems to have been fine for everything else, _but_ this package.

This would be because you have

```
exports.default = MaskedInput;
module.exports = exports['default'];
```

Now, in typescript, you can't do the above as it doesn't automatically assume default is the object itself. At least, that's what I think is going on.

But I've now got conflicting imports for this package.

```typescript
import * as MaskedInput from 'react-maskedinput'; // works with commonjs module without default export
import MaskedInput from 'react-maskedinput'; // works with es module
```

I'm not sure what's the best way to go about dealing with this, and I'm conscious that I've submitted something to update the typings for this package that actually conflict with the two different ways. See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/18058.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.