diff --git a/composer.json b/composer.json index 847ece7..662ab59 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,7 @@ "ivopetkov/html5-dom-document-php": "^2.0", "apility/netflex-support": "^1.0", "psy/psysh": "^0.9.9", - "apility/webpack-assets": "^1.0" + "apility/webpack-assets": "^1.0.2" }, "require-dev": { "phpunit/phpunit": "^8.1", diff --git a/composer.lock b/composer.lock index 170df02..6a7d584 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "6bb617308bbc9ed692fdf67d76a64868", + "content-hash": "a7974bba60ff86c158a2eaee99570455", "packages": [ { "name": "apility/netflex-api", @@ -86,16 +86,16 @@ }, { "name": "apility/webpack-assets", - "version": "v1.0.0", + "version": "v1.0.2", "source": { "type": "git", "url": "https://github.com/apility/webpack-assets.git", - "reference": "7a5b9a8a4c371e50b89db185fa90675b3006c120" + "reference": "eb324d62748ece842353bbb96af82b51bccf01a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/apility/webpack-assets/zipball/7a5b9a8a4c371e50b89db185fa90675b3006c120", - "reference": "7a5b9a8a4c371e50b89db185fa90675b3006c120", + "url": "https://api.github.com/repos/apility/webpack-assets/zipball/eb324d62748ece842353bbb96af82b51bccf01a2", + "reference": "eb324d62748ece842353bbb96af82b51bccf01a2", "shasum": "" }, "require": { @@ -115,7 +115,7 @@ "MIT" ], "description": "A helper class for reading the manifest generated by webpack-assets-manifest, and output relevant link and script tags.", - "time": "2019-11-12T14:08:48+00:00" + "time": "2019-11-13T14:09:34+00:00" }, { "name": "dnoegel/php-xdg-base-dir", diff --git a/src/NF.php b/src/NF.php index af3c1df..867a4b7 100644 --- a/src/NF.php +++ b/src/NF.php @@ -117,16 +117,19 @@ public static function init($site = null, $branch = null, $path = []) self::$commerce = new Commerce(); self::$search = new ElasticSearch(); - - self::setWebpackAssets(); } /** Sets webpackAssets */ public static function setWebpackAssets () { + global $payload; + + $basePath = $payload->domain ?? null; + self::$webpackAssets = isset(self::$config['webpackManifest']) ? new WebpackAssets(self::$config['webpackManifest'], [ 'defaultEntrypoint' => 'app', 'preload' => true, + 'basePath' => $basePath, ]) : null; diff --git a/src/controller_page.php b/src/controller_page.php index 68112f6..8b67b15 100644 --- a/src/controller_page.php +++ b/src/controller_page.php @@ -23,6 +23,8 @@ $payload = NF::$jwt->decode($token); $controller = NF::nfPath('pagefinder/' . $payload->scope . '_' . $payload->relation . '.php'); + NF::setWebpackAssets(); + if (file_exists($controller)) { require $controller; die(); @@ -33,6 +35,8 @@ die('Invalid or expired token'); } +NF::setWebpackAssets(); + if ($url == '') { $url = 'index'; }