tailwindcss/integrations/tailwindcss-cli
Jordan Pittman ba55a445cd
Fix native ESM config loading in v3 (#18938)
Unfortunately for backwards compatibility purposes (with `loadConfig` at
least) we can't switch things to use `import(…)` because there's baked
in knowledge that the config is loaded synchronously for v3.

This PR does two things:
- Defers to `require(…)` which allows newer versions that support
`require(esm)` to work natively. This works around the need to switch to
`import(…)` for those versions.
- Allows newer versions of `postcss-load-config` enabling better
ESM+TypeScript support for PostCSS configs in the CLI.

We support v4, v5, and v6 of `postcss-load-config` simultaneously so any
of those versions should work. I've verified that newer node versions
seem to install v6 while earlier ones like Node v14 install v4 of
`postcss-load-config`. So this should be a backwards compatible change.

- [x] needs tests for `import.meta.resolve(…)`
- [x] needs tests for ESM postcss configs

Fixes #14152
Fixes #14423
2025-09-16 14:03:09 -04:00
..
src Fix failing integration tests in CI (#13300) 2024-03-21 13:23:19 +01:00
tests Fix native ESM config loading in v3 (#18938) 2025-09-16 14:03:09 -04:00
.gitignore Add script for running integration tests 2023-01-21 11:28:24 -05:00
package.json transform files using @swc/jest (#10815) 2023-03-17 16:22:16 +01:00
postcss.config.js Improve new JIT-compatible CLI (#4558) 2021-06-04 10:28:09 -04:00
tailwind.config.js Update integration tests (#8386) 2022-05-19 16:44:20 -04:00