diff --git a/bin/helpers/merge.ts b/bin/helpers/merge.ts index 369dfa82e..d94bf8a18 100644 --- a/bin/helpers/merge.ts +++ b/bin/helpers/merge.ts @@ -185,12 +185,16 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon const injectFilePath = path.join(npmDirectory, `src-tauri/src/inject/custom.js`); // inject js or css files - if (inject?.length > 0) { - if (!inject.every(item => item.endsWith('.css') || item.endsWith('.js'))) { + let injects = inject && Array.isArray(inject) ? inject : [] + if (inject && typeof inject === 'string') { + injects.push(inject); + } + if (injects.length > 0) { + if (!injects.every(item => item.endsWith('.css') || item.endsWith('.js'))) { logger.error('The injected file must be in either CSS or JS format.'); return; } - const files = inject.map(filepath => (path.isAbsolute(filepath) ? filepath : path.join(process.cwd(), filepath))); + const files = injects.map(filepath => (path.isAbsolute(filepath) ? filepath : path.join(process.cwd(), filepath))); tauriConf.pake.inject = files; await combineFiles(files, injectFilePath); } else {