fix build type check when document.currentScript is unsupported