fix loading assets from CDN
This commit is contained in:
parent
9b6bf7ba7a
commit
d87791ab3d
|
|
@ -1,13 +1,14 @@
|
|||
/* eslint-disable prefer-const */
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
|
||||
// @ts-ignore
|
||||
declare let __webpack_public_path__: string
|
||||
|
||||
const url = new URL(blessing.base_url)
|
||||
url.port = '8080'
|
||||
|
||||
__webpack_public_path__ =
|
||||
process.env.NODE_ENV === 'development'
|
||||
? url.toString()
|
||||
: `${blessing.base_url}/app/`
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const url = new URL(blessing.base_url)
|
||||
url.port = '8080'
|
||||
__webpack_public_path__ = url.toString()
|
||||
} else {
|
||||
const link = document.querySelector<HTMLLinkElement>('link#cdn-host')
|
||||
const base = link?.href ?? blessing.base_url
|
||||
__webpack_public_path__ = `${base}/app/`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
{{ seo.extra|striptags('<meta>')|raw }}
|
||||
<link rel="preconnect" href="https://cdn.jsdelivr.net/" crossorigin>
|
||||
{% if custom_cdn_host %}
|
||||
<link rel="preconnect" href="{{ custom_cdn_host }}" crossorigin>
|
||||
<link rel="preconnect" href="{{ custom_cdn_host }}" id="cdn-host" crossorigin>
|
||||
{% endif %}
|
||||
<script id="blessing-globals" type="application/json">{{ blessing|json_encode|raw }}</script>
|
||||
<script src="{{ url('/meta.js') }}"></script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user