Skip to content

Commit

Permalink
feat: support using config.cjs/cts (#1000)
Browse files Browse the repository at this point in the history
Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
  • Loading branch information
CHOYSEN and brc-dd committed Jul 17, 2022
1 parent 5c2854f commit 66be1de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/config/introduction.md
Expand Up @@ -11,6 +11,10 @@ Place your configuration file at `.vitepress/config.js`. This is where all ViteP
└─ package.json
```

::: tip
You can also use any of `.ts`, `.cjs`, `.mjs`, `.cts`, `.mts` as the config file extension.
:::

VitePress comes with 2 types of configs. One is the [App Configs](./app-configs) which configures the site's fundamental features such as setting title of the site, or customize how markdown parser works. Second is the [Theme Config](./theme-configs) which configures the theme of the site, for example, adding a sidebar, or add features such as "Edit this page on GitHub" link.

There's also another configuration you may do in [Frontmatter](./frontmatter-configs). Frontmatter configs can override global configs defined on App Configs or Theme Configs for that specific page. However, there're several options that are only available at frontmatter as well.
Expand Down
2 changes: 1 addition & 1 deletion src/node/config.ts
Expand Up @@ -196,7 +196,7 @@ export async function resolveConfig(
return config
}

const supportedConfigExtensions = ['js', 'ts', 'mjs', 'mts']
const supportedConfigExtensions = ['js', 'ts', 'cjs', 'mjs', 'cts', 'mts']

async function resolveUserConfig(
root: string,
Expand Down

0 comments on commit 66be1de

Please sign in to comment.