-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1] Initial Vite & Craft Plugin config
- Loading branch information
1 parent
ea5c7b5
commit 6789ba8
Showing
15 changed files
with
955 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
use craft\helpers\App; | ||
|
||
|
||
// Decide which port to use for devServerPublic. This allows | ||
// you to visit the http or https port. If you plant to only | ||
// use http, make sure that PRIMARY_SITE_URL is set to http | ||
|
||
$host = Craft::$app->getRequest()->getIsConsoleRequest() | ||
? App::env('PRIMARY_SITE_URL') | ||
: Craft::$app->getRequest()->getHostInfo(); | ||
|
||
// Match ports in .ddev/config.yaml -> web_extra_exposed_ports | ||
$httpPort = 3000; | ||
$httpsPort = 3001; | ||
$devServerPort = str_starts_with($host, 'https') ? $httpsPort : $httpPort; | ||
|
||
return [ | ||
'devServerPublic' => "$host:$devServerPort", | ||
'serverPublic' => '/dist/', | ||
'useDevServer' => App::env('CRAFT_ENVIRONMENT') === 'dev', | ||
'manifestPath' => '@webroot/dist/.vite/manifest.json', | ||
]; |
Oops, something went wrong.