Skip to content

Commit

Permalink
turbopack-node: Use path.join for postcss loader (#8105)
Browse files Browse the repository at this point in the history
### Description

A followup requested by @sokra in
#7995 (comment)

There's no meaningful change in behavior here, as node on windows
interprets both `/` and `\` as valid path separators, but this makes the
intent clearer.

### Testing Instructions

<details><summary>Repeated the test plan for #7995. Tested on both
Windows and Linux.</summary>

![Screenshot 2024-05-07 at
2.22.17 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/HAZVitxRNnZz8QMiPn4a/bf7afcfb-0834-454a-b5ee-f52ae736eb47.png)
</details>


Closes PACK-3049
  • Loading branch information
bgw committed May 8, 2024
1 parent f74660c commit 50d6b41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/turbopack-node/src/transforms/postcss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,10 @@ pub(crate) async fn config_loader_source(
// Bundling would break the ability to use `require.resolve` in the config file.
let code = formatdoc! {
r#"
import {{ pathToFileURL }} from 'url';
import {{ pathToFileURL }} from 'node:url';
import path from 'node:path';
const configPath = `${{process.cwd()}}/${{{config_path}}}`;
const configPath = path.join(process.cwd(), {config_path});
// Absolute paths don't work with ESM imports on Windows:
// https://github.com/nodejs/node/issues/31710
// convert it to a file:// URL, which works on all platforms
Expand Down

0 comments on commit 50d6b41

Please sign in to comment.