chore: 兼容没有 currentScript 的情况

This commit is contained in:
力皓 2020-08-20 19:38:39 +08:00
parent fa8706600e
commit c69f5fac43
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-editor-core",
"version": "0.8.30",
"version": "0.8.31",
"description": "Core Api for Ali lowCode engine",
"license": "MIT",
"main": "lib/index.js",

View File

@ -1,5 +1,5 @@
const publicPath = (document.currentScript as HTMLScriptElement).src.replace(/^(.*\/)[^/]+$/, '$1');
const publicPath = (document.currentScript as HTMLScriptElement)?.src.replace(/^(.*\/)[^/]+$/, '$1');
export function getPublicPath(): string {
return publicPath;
return publicPath || '';
}