Skip to content

Commit

Permalink
Support .js, .mjs and .cjs configuration files using findUp
Browse files Browse the repository at this point in the history
  • Loading branch information
nib-bturner committed Nov 8, 2023
1 parent bbb17e1 commit 8dc29ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,7 @@ module.exports = {
## ESM Support
Playroom supports loading [ESM](https://nodejs.org/api/esm.html#introduction) configuration files. If you are using a `.mjs` file extension, you will need to include the `--config` option when using Playroom:
```sh
npx playroom --config playroom.config.mjs
```
Playroom supports loading [ESM](https://nodejs.org/api/esm.html#introduction) configuration files. By default, Playroom will look for a playroom config file with either a `.js`, `.mjs` or `.cjs` file extension.
## Storybook Integration
Expand Down
5 changes: 4 additions & 1 deletion bin/cli.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ const showUsage = () => {
const cwd = process.cwd();
const configPath = args.config
? path.resolve(cwd, args.config)
: await findUp('playroom.config.js', { cwd });
: await findUp(
['playroom.config.js', 'playroom.config.mjs', 'playroom.config.cjs'],
{ cwd }
);

if (!configPath) {
console.error(
Expand Down

0 comments on commit 8dc29ba

Please sign in to comment.