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

refactor: change plugin export from default to named #274

Merged
merged 5 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Install the package from `npm`:
Add it to your `rollup.config.js`:

```js
import dts from "rollup-plugin-dts";
import { dts } from "rollup-plugin-dts";

const config = [
// …
Expand All @@ -28,6 +28,8 @@ const config = [
export default config;
```

**NOTE** A [default import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#default_import) of the plugin using `import dts from "rollup-plugin-dts";` is still supported for existing implementations of this package. However, a [named import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#named_import) is suggested to avoid the error `[!] TypeError: dts is not a function`[^1][^2] in certain rollup config file implementations.

And then instruct typescript where to find your definitions inside your `package.json`:

```json
Expand Down Expand Up @@ -82,3 +84,7 @@ about some of these projects and their tradeoffs.

The code is licensed under the copyleft **LGPL-3.0**. I have no intention to
license this under any non-copyleft license.


[^1]: [StackOverflow thread](https://stackoverflow.com/questions/74255565/rollup-typescript-error-dts-is-not-a-function/74304876#74304876) of issue
[^2]: [Github issue](https://github.com/Swatinem/rollup-plugin-dts/issues/247)
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,4 @@ const plugin: PluginImpl<Options> = (options = {}) => {
} satisfies Plugin;
};

export default plugin;
export { plugin as dts, plugin as default } ;