From 48b3381b15562490870b0cf32f15252038958384 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Mon, 17 Oct 2022 14:19:41 +0200 Subject: [PATCH] fix: use loader from config for postcss (#744) --- src/esbuild/index.ts | 2 +- src/esbuild/postcss.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/esbuild/index.ts b/src/esbuild/index.ts index 8157f0bf..c02b5f4c 100644 --- a/src/esbuild/index.ts +++ b/src/esbuild/index.ts @@ -160,7 +160,7 @@ export async function runEsbuild( }), options.tsconfigDecoratorMetadata && swcPlugin({ logger }), nativeNodeModulesPlugin(), - postcssPlugin({ css, inject: options.injectStyle }), + postcssPlugin({ css, inject: options.injectStyle, cssLoader: loader['.css'] }), sveltePlugin({ css }), ...(options.esbuildPlugins || []), ] diff --git a/src/esbuild/postcss.ts b/src/esbuild/postcss.ts index e7b85140..806eeeaf 100644 --- a/src/esbuild/postcss.ts +++ b/src/esbuild/postcss.ts @@ -1,14 +1,16 @@ import fs from 'fs' import path from 'path' -import { Plugin, transform } from 'esbuild' +import { Loader, Plugin, transform } from 'esbuild' import { getPostcss } from '../utils' export const postcssPlugin = ({ css, inject, + cssLoader, }: { css?: Map inject?: boolean + cssLoader?: Loader }): Plugin => { return { name: 'postcss', @@ -132,7 +134,7 @@ export const postcssPlugin = ({ return { contents, - loader: 'css', + loader: cssLoader ?? 'css', } }) },