Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .mts and .cts config file detection #13940

Merged
merged 4 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Disable automatic `var()` injection for anchor properties ([#13826](https://github.com/tailwindlabs/tailwindcss/pull/13826))
- Use no value instead of `blur(0px)` for `backdrop-blur-none` and `blur-none` utilities ([#13830](https://github.com/tailwindlabs/tailwindcss/pull/13830))
- Add `.mts` and `.cts` config file detection ([#13940](https://github.com/tailwindlabs/tailwindcss/pull/13940))

## [3.4.4] - 2024-06-05

Expand Down
11 changes: 11 additions & 0 deletions src/lib/load-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ function lazyJiti() {

export function loadConfig(path: string): Config {
let config = (function () {
// Always use jiti for ESM or TS files
if (
path &&
(path.endsWith('.mjs') ||
path.endsWith('.ts') ||
path.endsWith('.cts') ||
path.endsWith('.mts'))
) {
return lazyJiti()(path)
}

try {
return path ? require(path) : {}
} catch {
Expand Down
2 changes: 2 additions & 0 deletions src/util/resolveConfigPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const defaultConfigFiles = [
'./tailwind.config.cjs',
'./tailwind.config.mjs',
'./tailwind.config.ts',
'./tailwind.config.cts',
'./tailwind.config.mts',
]

function isObject(value) {
Expand Down
Loading