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
This commit is contained in:
parent
ff52f8caf2
commit
ba55a445cd
9 changed files with 164 additions and 45 deletions
2
.github/workflows/ci-stable.yml
vendored
2
.github/workflows/ci-stable.yml
vendored
|
|
@ -27,7 +27,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14, 18]
|
||||
node-version: [14, 18, 20, 22, 24]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
|
|
|||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -24,7 +24,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14, 18]
|
||||
node-version: [14, 18, 20, 22, 24]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
|
|
|||
2
.github/workflows/integration-tests.yml
vendored
2
.github/workflows/integration-tests.yml
vendored
|
|
@ -31,7 +31,7 @@ jobs:
|
|||
- vite
|
||||
- webpack-4
|
||||
- webpack-5
|
||||
node-version: [18]
|
||||
node-version: [18, 20]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue