Skip to content

Commit b2580cc

Browse files
authored
docs: update API example to ESM (#611)
1 parent 3159edb commit b2580cc

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎README.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ Check out documentation and other usage examples in the [`docs` directory](./doc
139139
Example:
140140
141141
```js
142-
const concurrently = require('concurrently');
142+
import path from 'node:path';
143+
import { concurrently } from 'concurrently';
144+
143145
const { result } = concurrently(
144146
[
145147
'npm:watch-*',
@@ -148,14 +150,14 @@ const { result } = concurrently(
148150
{
149151
command: 'watch',
150152
name: 'watch',
151-
cwd: path.resolve(__dirname, 'scripts/watchers'),
153+
cwd: path.resolve(import.meta.dirname, 'scripts/watchers'),
152154
},
153155
],
154156
{
155157
prefix: 'name',
156158
killOthersOn: ['failure', 'success'],
157159
restartTries: 3,
158-
cwd: path.resolve(__dirname, 'scripts'),
160+
cwd: path.resolve(import.meta.dirname, 'scripts'),
159161
},
160162
);
161163
result.then(success, failure);

0 commit comments

Comments
 (0)