diff --git a/README.md b/README.md index 129d59c..91ad614 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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); ```
@@ -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 @@ -105,7 +105,7 @@ Using a different basePath ```javascript const { someFunction } = importSync( - 'someModule', + './someModule', { basePath: process.cwd() } ); ``` @@ -114,7 +114,7 @@ Using additional esm options as described in esm's [documentation](https://githu ```javascript const { someFunction } = importSync( - 'someModule', + './someModule', { esmOptions: { cjs: { @@ -127,6 +127,12 @@ const { someFunction } = importSync( ); ``` +Importing an ESM-only module + +```javascript +const fetch = importSync('node-fetch'), +``` +

diff --git a/package-lock.json b/package-lock.json index 038dc16..56f72f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "import-sync", - "version": "2.0.4", + "version": "2.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "import-sync", - "version": "2.0.4", + "version": "2.0.5", "license": "MIT", "dependencies": { "esm": "^3.2.25" diff --git a/package.json b/package.json index e766c3e..cb3a981 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "type": "git", "url": "https://github.com/nktnet1/import-sync" }, - "version": "2.0.4", + "version": "2.0.5", "files": [ "dist" ],