main/core/Twig/WebpackExtension.php
public function hotAsset($path, $hot = true)
    {
        $assets = $this->getWebpackAssets();
        $assetName = pathinfo($path, PATHINFO_FILENAME);

        if (!isset($assets[$assetName])) {
            $assetNames = implode("\n", array_keys($assets));

            throw new \Exception(
                "Cannot find asset '{$assetName}' in webpack stats. Found:\n{$assetNames})"
            );
        }

        if ('dev' === $this->environment && $hot) {
            // for dev serve fill from webpack-dev-server
            return 'http://localhost:8080/dist/'.$assets[$assetName]['js'];
        }

        // otherwise serve static generated files
        return $this->assetExtension->getAssetUrl(
            'dist/'.$assets[$assetName]['js']
        );
    }
public function hotAsset($path, $hot = true)
    {
        $assets = $this->getWebpackAssets();
        $assetName = pathinfo($path, PATHINFO_FILENAME);

        if (!isset($assets[$assetName])) {
            $assetNames = implode("\n", array_keys($assets));

            throw new \Exception(
                "Cannot find asset '{$assetName}' in webpack stats. Found:\n{$assetNames})"
            );
        }

        if ('dev' === $this->environment && $hot) {
            // for dev serve fill from webpack-dev-server
            return 'http://localhost:8080/dist/'.$assets[$assetName]['js'];
        }

        // otherwise serve static generated files
        return $this->assetExtension->getAssetUrl(
            'dist/'.$assets[$assetName]['js']
        );
    }
public function hotAsset ( $ path , $ hot = true ) { $ assets = $ this -> getWebpackAssets ( ) ; $ assetName = pathinfo ( $ path , PATHINFO_FILENAME ) ; if ( ! isset ( $ assets [ $ assetName ] ) ) { $ assetNames = implode ( "\n" , array_keys ( $ assets ) ) ; throw new \ Exception ( "Cannot find asset '{$assetName}' in webpack stats. Found:\n{$assetNames})" ) ; } if ( 'dev' === $ this -> environment && $ hot ) { // for dev serve fill from webpack-dev-server return 'http://localhost:8080/dist/' . $ assets [ $ assetName ] [ 'js' ] ; } // otherwise serve static generated files return $ this -> assetExtension -> getAssetUrl ( 'dist/' . $ assets [ $ assetName ] [ 'js' ] ) ; }
Returns the URL of an asset managed by webpack. The final URL will depend
on the environment and the version hash generated by webpack.

@param string $path
@param bool   $hot

@return string

@throws \Exception
Returns the URL of an asset managed by webpack . The final URL will depend on the environment and the version hash generated by webpack .