Make front end assets URL flexible
This commit is contained in:
parent
7ae8a6325d
commit
0bbeaa7246
|
|
@ -9,7 +9,8 @@ if (! function_exists('webpack_assets')) {
|
||||||
function webpack_assets($relativeUri)
|
function webpack_assets($relativeUri)
|
||||||
{
|
{
|
||||||
if (app()->environment('development')) {
|
if (app()->environment('development')) {
|
||||||
return "http://127.0.0.1:8080/$relativeUri"; // @codeCoverageIgnore
|
$host = parse_url(url('/'), PHP_URL_HOST);
|
||||||
|
return "http://$host:8080/$relativeUri"; // @codeCoverageIgnore
|
||||||
} else {
|
} else {
|
||||||
$path = app('webpack')->$relativeUri;
|
$path = app('webpack')->$relativeUri;
|
||||||
$cdn = option('cdn_address');
|
$cdn = option('cdn_address');
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
/* eslint-disable prefer-const */
|
/* eslint-disable prefer-const */
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
declare let __webpack_public_path__: string
|
declare let __webpack_public_path__: string
|
||||||
|
|
||||||
|
const url = new URL(blessing.base_url)
|
||||||
|
url.port = '8080'
|
||||||
|
|
||||||
__webpack_public_path__ = process.env.NODE_ENV === 'development'
|
__webpack_public_path__ = process.env.NODE_ENV === 'development'
|
||||||
? 'http://127.0.0.1:8080/'
|
? url.toString()
|
||||||
: `${blessing.base_url}/app/`
|
: `${blessing.base_url}/app/`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user