Skip to content

Commit

Permalink
fix: should not emit assets that are inlined
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 22, 2020
1 parent 885052d commit 77dad04
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/node/build/buildPluginAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ export const resolveAsset = async (
const resolvedFileName = `${baseName}.${hash_sum(id)}${ext}`

let url = slash(path.join(publicBase, assetsDir, resolvedFileName))
const content = await fs.readFile(id)
let content: Buffer | undefined = await fs.readFile(id)
if (!id.endsWith(`.svg`) && content.length < Number(inlineLimit)) {
url = `data:${mime.lookup(id)};base64,${content.toString('base64')}`
content = undefined
}

resolved = {
Expand Down

0 comments on commit 77dad04

Please sign in to comment.