Skip to content

Commit 26ef112

Browse files
Update esm.md (#1862)
Move the chapter about configuration file at the top of the doc to give it more visibility
1 parent 9e9ec3c commit 26ef112

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/esm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
You can optionally write your support code (steps, hooks, etc) with native ES modules syntax - i.e. using `import` and `export` statements without transpiling. This is enabled without any additional configuration, and you can use either of the `.js` or `.mjs` file extensions.
44

5+
**Important**: please note that your configuration file referenced for [Profiles](./profiles.md) - aka `cucumber.js` file - must remain a CommonJS file. In a project with `type=module`, you can name the file `cucumber.cjs`, since Node expects `.js` files to be in ESM syntax in such projects.
6+
57
Example (adapted from [our original example](./nodejs_example.md)):
68

79
```javascript
@@ -30,5 +32,3 @@ As well as support code, these things can also be in ES modules syntax:
3032
You can use ES modules selectively/incrementally - so you can have a mixture of CommonJS and ESM in the same project.
3133

3234
When using a transpiler for e.g. TypeScript, ESM isn't supported - you'll need to configure your transpiler to output modules in CommonJS syntax (for now).
33-
34-
The config file referenced for [Profiles](./profiles.md) can only be in CommonJS syntax. In a project with `type=module`, you can name the file `cucumber.cjs`, since Node expects `.js` files to be in ESM syntax in such projects.

0 commit comments

Comments
 (0)