Skip to content

Commit

Permalink
fix: Emit warning when inlining Git LFS placeholder during lib build
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorBreakfast committed Aug 24, 2022
1 parent 7f880dd commit bd14f70
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/vite/src/node/plugins/asset.ts
Expand Up @@ -11,6 +11,7 @@ import type {
RenderedChunk
} from 'rollup'
import MagicString from 'magic-string'
import colors from 'picocolors'
import { toOutputFilePathInString } from '../build'
import type { Plugin } from '../plugin'
import type { ResolvedConfig } from '../config'
Expand Down Expand Up @@ -437,6 +438,12 @@ async function fileToBuiltUrl(
content.length < Number(config.build.assetsInlineLimit) &&
!isGitLfsPlaceholder(content))
) {
if (config.build.lib && isGitLfsPlaceholder(content)) {
config.logger.warn(
colors.yellow(`Inlined file ${id} was not downloaded via Git LFS`)
)
}

const mimeType = mrmime.lookup(file) ?? 'application/octet-stream'
// base64 inlined as a string
url = `data:${mimeType};base64,${content.toString('base64')}`
Expand Down

0 comments on commit bd14f70

Please sign in to comment.