feat(includeFiles): support {from, to} object form for custom serve paths
includeFiles now accepts string | {from, to} entries. The object form
allows specifying a custom serve path (e.g. ./html/index.html -> index.html)
for base64ts bundled content.
This commit is contained in:
@@ -105,8 +105,12 @@ export class CustomBundleHandler {
|
||||
|
||||
// Add included files
|
||||
if (bundleConfig.includeFiles && bundleConfig.includeFiles.length > 0) {
|
||||
for (const pattern of bundleConfig.includeFiles) {
|
||||
await base64Output.addFilesFromGlob(pattern);
|
||||
for (const entry of bundleConfig.includeFiles) {
|
||||
if (typeof entry === 'string') {
|
||||
await base64Output.addFilesFromGlob(entry);
|
||||
} else {
|
||||
await base64Output.addFileWithServePath(entry.from, entry.to);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +139,8 @@ export class CustomBundleHandler {
|
||||
const htmlHandler = new HtmlHandler();
|
||||
const outputDir = plugins.path.dirname(toPath);
|
||||
|
||||
for (const pattern of bundleConfig.includeFiles) {
|
||||
for (const entry of bundleConfig.includeFiles) {
|
||||
const pattern = typeof entry === 'string' ? entry : entry.from;
|
||||
await this.copyIncludedFiles(pattern, outputDir);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user