Make front end assets URL flexible

This commit is contained in:
Pig Fang 2019-07-02 11:35:29 +08:00
parent 7ae8a6325d
commit 0bbeaa7246
2 changed files with 7 additions and 2 deletions

View File

@ -9,7 +9,8 @@ if (! function_exists('webpack_assets')) {
function webpack_assets($relativeUri)
{
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 {
$path = app('webpack')->$relativeUri;
$cdn = option('cdn_address');

View File

@ -1,6 +1,10 @@
/* eslint-disable prefer-const */
/* eslint-disable camelcase */
declare let __webpack_public_path__: string
const url = new URL(blessing.base_url)
url.port = '8080'
__webpack_public_path__ = process.env.NODE_ENV === 'development'
? 'http://127.0.0.1:8080/'
? url.toString()
: `${blessing.base_url}/app/`