diff --git a/src/esbuild/postcss.ts b/src/esbuild/postcss.ts index 1c754022..ec6fb599 100644 --- a/src/esbuild/postcss.ts +++ b/src/esbuild/postcss.ts @@ -9,7 +9,7 @@ export const postcssPlugin = ({ cssLoader, }: { css?: Map - inject?: boolean | ((css: string, fileId: string) => string) + inject?: boolean | ((css: string, fileId: string) => Promise) cssLoader?: Loader }): Plugin => { return { @@ -124,7 +124,7 @@ export const postcssPlugin = ({ contents = typeof inject === 'function' - ? inject(JSON.stringify(contents), args.path) + ? await inject(JSON.stringify(contents), args.path) : `import styleInject from '#style-inject';styleInject(${JSON.stringify( contents, )})` diff --git a/src/options.ts b/src/options.ts index 68c8d3ff..ed09cb5e 100644 --- a/src/options.ts +++ b/src/options.ts @@ -210,7 +210,7 @@ export type Options = { * Inject CSS as style tags to document head * @default {false} */ - injectStyle?: boolean | ((css: string, fileId: string) => string) + injectStyle?: boolean | ((css: string, fileId: string) => Promise) /** * Inject cjs and esm shims if needed * @default false