Skip to content

Commit 48b3381

Browse files
authoredOct 17, 2022
fix: use loader from config for postcss (#744)
1 parent fd0d787 commit 48b3381

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed
 

‎src/esbuild/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export async function runEsbuild(
160160
}),
161161
options.tsconfigDecoratorMetadata && swcPlugin({ logger }),
162162
nativeNodeModulesPlugin(),
163-
postcssPlugin({ css, inject: options.injectStyle }),
163+
postcssPlugin({ css, inject: options.injectStyle, cssLoader: loader['.css'] }),
164164
sveltePlugin({ css }),
165165
...(options.esbuildPlugins || []),
166166
]

‎src/esbuild/postcss.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import fs from 'fs'
22
import path from 'path'
3-
import { Plugin, transform } from 'esbuild'
3+
import { Loader, Plugin, transform } from 'esbuild'
44
import { getPostcss } from '../utils'
55

66
export const postcssPlugin = ({
77
css,
88
inject,
9+
cssLoader,
910
}: {
1011
css?: Map<string, string>
1112
inject?: boolean
13+
cssLoader?: Loader
1214
}): Plugin => {
1315
return {
1416
name: 'postcss',
@@ -132,7 +134,7 @@ export const postcssPlugin = ({
132134

133135
return {
134136
contents,
135-
loader: 'css',
137+
loader: cssLoader ?? 'css',
136138
}
137139
})
138140
},

1 commit comments

Comments
 (1)

vercel[bot] commented on Oct 17, 2022

@vercel[bot]
Please sign in to comment.