diff --git a/packages/component/.fatherrc.ts b/packages/component/.fatherrc.ts index 1bb7f40993..586f65b4c4 100644 --- a/packages/component/.fatherrc.ts +++ b/packages/component/.fatherrc.ts @@ -6,6 +6,7 @@ export default { cjs: { output:'lib' }, + platform:'browser', autoprefixer: { browsers: ['IE 11', 'last 2 versions'], }, diff --git a/packages/core/src/services/asset/FontService.ts b/packages/core/src/services/asset/FontService.ts index 0c790145d5..53c1b7cb9c 100644 --- a/packages/core/src/services/asset/FontService.ts +++ b/packages/core/src/services/asset/FontService.ts @@ -172,26 +172,27 @@ export default class FontService extends EventEmitter implements IFontService { url('${fontPath}') format('woff'), url('${fontPath}') format('truetype'); }`; - document.getElementsByTagName('head')[0].appendChild(style); - style.onload=()=>{ - if ( document.fonts) { - try { - // @ts-ignore - document.fonts.load(`24px ${fontFamily}`, 'L7text'); - document.fonts.ready.then(()=>{ - this.emit('fontloaded',{ - fontFamily - }) - }) - - } catch (e) { - console.warn('当前环境不支持 document.fonts !'); - console.warn('当前环境不支持 iconfont !'); - console.warn(e); + style.onload=()=>{ + if ( document.fonts) { + try { + // @ts-ignore + document.fonts.load(`24px ${fontFamily}`, 'L7text'); + document.fonts.ready.then(()=>{ + this.emit('fontloaded',{ + fontFamily + }) + }) + + } catch (e) { + console.warn('当前环境不支持 document.fonts !'); + console.warn('当前环境不支持 iconfont !'); + console.warn(e); + } + } + } - } + document.getElementsByTagName('head')[0].appendChild(style); - } } public destroy(): void { diff --git a/packages/maps/.fatherrc.ts b/packages/maps/.fatherrc.ts index 1bb7f40993..8ba43fc58a 100644 --- a/packages/maps/.fatherrc.ts +++ b/packages/maps/.fatherrc.ts @@ -4,8 +4,10 @@ export default { output:'es' }, cjs: { + output:'lib' }, + platform:'browser', autoprefixer: { browsers: ['IE 11', 'last 2 versions'], },