function warnIfLongLoadTime()

in src/loadScriptFile.ts [74:94]


function warnIfLongLoadTime(filePath: string, start: number): void {
    const timeElapsed = Date.now() - start;
    const rfpName = 'WEBSITE_RUN_FROM_PACKAGE';
    const rfpValue = process.env[rfpName];
    if (
        timeElapsed > 1000 &&
        (rfpValue === undefined || rfpValue === '0') &&
        process.env.AZURE_FUNCTIONS_ENVIRONMENT !== 'Development' // don't show in core tools
    ) {
        worker.log({
            message: `Loading "${path.basename(filePath)}" took ${timeElapsed}ms`,
            level: LogLevel.Warning,
            logCategory: LogCategory.System,
        });
        worker.log({
            message: `Set "${rfpName}" to "1" to significantly improve load times. Learn more here: https://aka.ms/AAjon54`,
            level: LogLevel.Warning,
            logCategory: LogCategory.System,
        });
    }
}