Skip to content

Commit

Permalink
Fix PostCSS dependency message handling (#73529)
Browse files Browse the repository at this point in the history
Closes PACK-3606
Closes #73422

It's `"dependency"`, not `"file-dependency"`... (the Typescript types
wouldn't have caught that either though)

https://github.com/webpack-contrib/postcss-loader/blob/8024e67c7b57c3656063f50465d924a24ec796ce/src/index.js#L191-L219

Apparently, we don't have a test for that...
  • Loading branch information
mischnic authored and devjiwonchoi committed Dec 9, 2024
1 parent 60f8640 commit 001fa4c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions turbopack/crates/turbopack-node/js/src/transforms/postcss.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
declare const __turbopack_external_require__: (id: string, thunk: () => any, esm?: boolean) => any;

import type {Processor} from "postcss";

// @ts-ignore
import postcss from "@vercel/turbopack/postcss";
// @ts-ignore
Expand All @@ -20,7 +22,7 @@ function toPath(file: string) {
return sep !== "/" ? relPath.replaceAll(sep, "/") : relPath;
}

let processor: any;
let processor: Processor | undefined;

export const init = async (ipc: Ipc<IpcInfoMessage, IpcRequestMessage>) => {
let config = importedConfig;
Expand Down Expand Up @@ -74,7 +76,7 @@ export default async function transform(
cssContent: string,
name: string
) {
const { css, map, messages } = await processor.process(cssContent, {
const { css, map, messages } = await processor!.process(cssContent, {
from: name,
to: name,
map: {
Expand All @@ -97,7 +99,7 @@ export default async function transform(
// There is also an info field, which we currently ignore
});
break;
case "file-dependency":
case "dependency":
case "missing-dependency":
ipc.sendInfo({
type: "fileDependency",
Expand Down

0 comments on commit 001fa4c

Please sign in to comment.