Skip to content

Commit

Permalink
fix: use loader from config for postcss (#744)
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Oct 17, 2022
1 parent fd0d787 commit 48b3381
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/esbuild/index.ts
Expand Up @@ -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 || []),
]
Expand Down
6 changes: 4 additions & 2 deletions 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<string, string>
inject?: boolean
cssLoader?: Loader
}): Plugin => {
return {
name: 'postcss',
Expand Down Expand Up @@ -132,7 +134,7 @@ export const postcssPlugin = ({

return {
contents,
loader: 'css',
loader: cssLoader ?? 'css',
}
})
},
Expand Down

1 comment on commit 48b3381

@vercel
Copy link

@vercel vercel bot commented on 48b3381 Oct 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.