Skip to content

Commit

Permalink
fix: files from npm packages containing pure CSS were not being extra…
Browse files Browse the repository at this point in the history
…cted properly #79
  • Loading branch information
coder-layne committed Apr 15, 2024
1 parent 854cb3f commit de09cf6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,12 @@ export default function VitePluginLibAssets(options: Options = {}): Plugin {
if (!isLibBuild)
return null

const importerDir = importer.endsWith(path.sep)
? importer
: path.dirname(importer)
const resolved = await this.resolve(source, importer)
if (resolved === null)
return null

// Full path of the imported file
const id = path.resolve(importerDir, source)
const { id } = resolved

if (cssLangFilter(id)) {
const assetsFromCss = await extractFromFile(this, id)
Expand Down

0 comments on commit de09cf6

Please sign in to comment.