src/helpers/Manifest.php
public static function getManifestFile(array $config, string $type = 'modern')
    {
        $manifest = null;
        // Determine whether we should use the devServer for HMR or not
        $devMode = Craft::$app->getConfig()->getGeneral()->devMode;
        self::$isHot = ($devMode && $config['useDevServer']);
        // Try to get the manifest
        while ($manifest === null) {
            $manifestPath = self::$isHot
                ? $config['devServer']['manifestPath']
                : $config['server']['manifestPath'];
            // Normalize the path
            $path = self::combinePaths($manifestPath, $config['manifest'][$type]);
            $manifest = self::getJsonFile($path);
            // If the manifest isn't found, and it was hot, fall back on non-hot
            if ($manifest === null) {
                // We couldn't find a manifest; throw an error
                self::reportError(Craft::t(
                    'twigpack',
                    'Manifest file not found at: {manifestPath}',
                    ['manifestPath' => $manifestPath]
                ), true);
                if (self::$isHot) {
                    // Try again, but not with home module replacement
                    self::$isHot = false;
                } else {
                    // Give up and return null
                    return null;
                }
            }
        }

        return $manifest;
    }
public static function getManifestFile(array $config, string $type = 'modern')
    {
        $manifest = null;
        // Determine whether we should use the devServer for HMR or not
        $devMode = Craft::$app->getConfig()->getGeneral()->devMode;
        self::$isHot = ($devMode && $config['useDevServer']);
        // Try to get the manifest
        while ($manifest === null) {
            $manifestPath = self::$isHot
                ? $config['devServer']['manifestPath']
                : $config['server']['manifestPath'];
            // Normalize the path
            $path = self::combinePaths($manifestPath, $config['manifest'][$type]);
            $manifest = self::getJsonFile($path);
            // If the manifest isn't found, and it was hot, fall back on non-hot
            if ($manifest === null) {
                // We couldn't find a manifest; throw an error
                self::reportError(Craft::t(
                    'twigpack',
                    'Manifest file not found at: {manifestPath}',
                    ['manifestPath' => $manifestPath]
                ), true);
                if (self::$isHot) {
                    // Try again, but not with home module replacement
                    self::$isHot = false;
                } else {
                    // Give up and return null
                    return null;
                }
            }
        }

        return $manifest;
    }
public static function getManifestFile ( array $ config , string $ type = 'modern' ) { $ manifest = null ; // Determine whether we should use the devServer for HMR or not $ devMode = Craft :: $ app -> getConfig ( ) -> getGeneral ( ) -> devMode ; self :: $ isHot = ( $ devMode && $ config [ 'useDevServer' ] ) ; // Try to get the manifest while ( $ manifest === null ) { $ manifestPath = self :: $ isHot ? $ config [ 'devServer' ] [ 'manifestPath' ] : $ config [ 'server' ] [ 'manifestPath' ] ; // Normalize the path $ path = self :: combinePaths ( $ manifestPath , $ config [ 'manifest' ] [ $ type ] ) ; $ manifest = self :: getJsonFile ( $ path ) ; // If the manifest isn't found, and it was hot, fall back on non-hot if ( $ manifest === null ) { // We couldn't find a manifest; throw an error self :: reportError ( Craft :: t ( 'twigpack' , 'Manifest file not found at: {manifestPath}' , [ 'manifestPath' => $ manifestPath ] ) , true ) ; if ( self :: $ isHot ) { // Try again, but not with home module replacement self :: $ isHot = false ; } else { // Give up and return null return null ; } } } return $ manifest ; }
Return a JSON-decoded manifest file

@param array  $config
@param string $type

@return null|array
@throws NotFoundHttpException
Return a JSON - decoded manifest file