UNPKG

@microsoft/windows-admin-center-sdk

Version:

Microsoft - Windows Admin Center Shell

20 lines (16 loc) 631 B
import { readdirSync } from 'fs'; import { TargetOptions } from '@angular-builders/custom-webpack'; export default (targetOptions: TargetOptions, indexHtml: string) => { const i = indexHtml.indexOf('</body>'); const bundlePath = './bundle'; const files = readdirSync(bundlePath); let insert = ''; for (const file of files) { if (file.indexOf('msftsme.') === 0 || file.indexOf('vendor.') === 0) { insert += `<script src="${file}" defer></script>`; } } return `${indexHtml.slice(0, i)} ${insert} ${indexHtml.slice(i)}`; };