Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix import error on TypeScript #45

Merged
merged 6 commits into from
Jan 13, 2020
Merged

Conversation

phanect
Copy link
Contributor

@phanect phanect commented Jan 12, 2020

If you write following TypeScript code:

import Sitemapper from "sitemapper";
const sitemapper = new Sitemapper({ /* ... */});

it is transpiled as follows:

const sitemapper_1 = require("sitemapper");
const sitemapper = new sitemapper_1.default({/* ... */});

To support code like this, babel-plugin-add-module-exports needs
addDefaultProperty option enabled.
Currently, Sitemapper does not work in TypeScript code since this option is disabled.

If you write following TypeScript code:

```
import Sitemapper from "sitemapper";
const sitemapper = new Sitemapper({ /* ... */});
```

it is transpiled as follows:

```
const sitemapper_1 = require("sitemapper");
const sitemapper = new sitemapper_1.default({/* ... */});
```

To support code like this, babel-plugin-add-module-exports needs
addDefaultProperty option enabled.
Before this commit is applied, Sitemapper did not work in TypeScript code since this option was disabled.
Copy link
Owner

@seantomburke seantomburke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seantomburke seantomburke merged commit f9a16d9 into seantomburke:master Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants