Skip to content

Commit 42f55e2

Browse files
Merge pull request #107 from filipsobol/main
Respect `logLevel`
2 parents 3514043 + 9c171fb commit 42f55e2

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/index.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,13 @@ export function viteSingleFile({
4949
inlinePattern = [],
5050
deleteInlinedFiles = true,
5151
}: Config = defaultConfig): PluginOption {
52-
53-
function warnNotInlined(filename: string) {
54-
console.debug(`NOTE: asset not inlined: ${filename}`)
55-
}
56-
5752
return {
5853
name: "vite:singlefile",
5954
config: useRecommendedBuildConfig ? _useRecommendedBuildConfig : undefined,
6055
enforce: "post",
61-
generateBundle: (_, bundle) => {
62-
console.debug("\n")
56+
generateBundle(_, bundle) {
57+
const warnNotInlined = ( filename: string ) => this.info( `NOTE: asset not inlined: ${ filename }` )
58+
this.info("\n")
6359
const files = {
6460
html: [] as string[],
6561
css: [] as string[],
@@ -88,7 +84,7 @@ export function viteSingleFile({
8884
}
8985
const jsChunk = bundle[filename] as OutputChunk
9086
if (jsChunk.code != null) {
91-
console.debug(`Inlining: ${filename}`)
87+
this.info(`Inlining: ${filename}`)
9288
bundlesToDelete.push(filename)
9389
replacedHtml = replaceScript(replacedHtml, jsChunk.fileName, jsChunk.code, removeViteModuleLoader)
9490
}
@@ -99,7 +95,7 @@ export function viteSingleFile({
9995
continue
10096
}
10197
const cssChunk = bundle[filename] as OutputAsset
102-
console.debug(`Inlining: ${filename}`)
98+
this.info(`Inlining: ${filename}`)
10399
bundlesToDelete.push(filename)
104100
replacedHtml = replaceCss(replacedHtml, cssChunk.fileName, cssChunk.source as string)
105101
}

0 commit comments

Comments
 (0)