From c31635d5ee603b94fa210d8e6787f02aabcc6644 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 22 Nov 2023 14:19:20 +0100 Subject: [PATCH] allow configure processOptions --- src/loader.ts | 6 +++++- src/loaders/postcss.ts | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/loader.ts b/src/loader.ts index 5c14f24..29b0545 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -1,5 +1,8 @@ import type { CommonOptions } from "esbuild"; -import type { AcceptedPlugin as PostcssPlugin } from "postcss"; +import type { + AcceptedPlugin as PostcssPlugin, + ProcessOptions as PostcssProcessOptions, +} from "postcss"; import type { Options as PostcssNestedOptions } from "postcss-nested"; import type { Options as AutoprefixerOptions } from "autoprefixer"; import type { Options as CssnanoOptions } from "cssnano"; @@ -43,6 +46,7 @@ export interface LoaderOptions { autoprefixer?: false | AutoprefixerOptions; cssnano?: false | CssnanoOptions; plugins?: PostcssPlugin[]; + processOptions?: Omit; }; } diff --git a/src/loaders/postcss.ts b/src/loaders/postcss.ts index 2625b07..59e9a1a 100644 --- a/src/loaders/postcss.ts +++ b/src/loaders/postcss.ts @@ -26,6 +26,7 @@ export const postcssLoader: Loader = async (input, ctx) => { ...(ctx.options.postcss?.plugins || []), ].filter(Boolean), ).process(contents, { + ...ctx.options.postcss?.processOptions, from: input.srcPath, });