Skip to content

[RFC] 缓存样式资源 #373

@maoxiaoke

Description

@maoxiaoke

背景

  1. 在 icestark 加载微应用过程中,样式资源均是通过 <link /> 标签进行加载,降低了应用的加载速度。
  2. 在应用开启 sandbox 或 loadScriptMode: fetch 的场景下,第二次加载应用时,脚本资源充分利用缓存。对于 jquery 或 angular 1.x 的应用可能产生脚本先执行,样式后加载,导致样式闪动

方案

当微应用配置为:

  • 开启沙箱 sandbox: true
  • loadScriptMode 为 'fetch'、'import'
  • umd 为 true (兼容场景)

开启样式资源缓存。

备注:若脚本资源可通过 fetch 来加载,则样式资源跨域的问题可认为是大几率不存在

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions