Skip to content

Commit

Permalink
2.0.5 - Fixed old documentation with relativePath instead of id imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nktnet committed Oct 20, 2023
1 parent 6ac0b48 commit 712e58f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Capable of importing ESM-only libraries such as [node-fetch@3](https://github.co

- [1. Installation](#1-installation)
- [2. Usage](#2-usage)
- [2.1. relativePath](#21-relativepath)
- [2.1. id](#21-id)
- [2.2. options](#22-options)
- [2.3. return](#23-return)
- [3. License](#3-license)
Expand All @@ -81,7 +81,7 @@ npm install import-sync
Try with [Replit](https://replit.com/@nktnet1/import-sync-example#index.js).

```
importSync(relativePath, options);
importSync(id, options);
```

<details closed>
Expand All @@ -92,7 +92,7 @@ importSync(relativePath, options);
Importing from the same directory

```javascript
const { someVariable, someFunction } = importSync('some-module');
const { someVariable, someFunction } = importSync('./some-module');
```

Importing `.mjs` file from a different directory
Expand All @@ -105,7 +105,7 @@ Using a different basePath

```javascript
const { someFunction } = importSync(
'someModule',
'./someModule',
{ basePath: process.cwd() }
);
```
Expand All @@ -114,7 +114,7 @@ Using additional esm options as described in esm's [documentation](https://githu

```javascript
const { someFunction } = importSync(
'someModule',
'./someModule',
{
esmOptions: {
cjs: {
Expand All @@ -127,6 +127,12 @@ const { someFunction } = importSync(
);
```

Importing an ESM-only module

```javascript
const fetch = importSync('node-fetch'),
```

</details>

<br/>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "git",
"url": "https://github.com/nktnet1/import-sync"
},
"version": "2.0.4",
"version": "2.0.5",
"files": [
"dist"
],
Expand Down

0 comments on commit 712e58f

Please sign in to comment.