icestark icon indicating copy to clipboard operation
icestark copied to clipboard

微模块打包后使用时@alifd/next/icon主题样式缺失

Open caojinjie opened this issue 2 years ago • 1 comments

问题:

  1. 使用微模块脚手架进行微模块组件编码,使用自定义的Fusion主题包,主题包中包含自定义的Icon图标,在组件js中引用该图标; image
  2. 通过modules形式分包构建该组件,打包后查看build/组件名/index.scss,其中缺少icon图标:before样式; image
  3. 通过主应用调用<MicroModule moduleInfo={} />形式加载组件的js和css,加载后图标无法显示,icon没有:before样式; image
  4. 查看组件的build文件夹,发现IP_legend_icon_gateway样式在build/index.css中,而不在build/组件目录/index.css中,实际在工程使用中不会引用build/index.css; image

期望

  1. 期望在分包打包后,样式能够全部打到build/组件目录/index.css中,不丢失样式;

延申

  1. 测试发现如果在build.json中不适用modules形式做分包加载,直接打包时,在产物build/index/index.css中样式是全的,其中包含了IP_legend_icon_gateway图标的:before样式;
  2. 怀疑可能是build-plugin-stark-module插件在modules下存在的问题;

caojinjie avatar Jun 21 '23 09:06 caojinjie

微模块组件Demo如下: micro-module.zip

@ClarkXia

caojinjie avatar Jun 21 '23 09:06 caojinjie