Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ice-scripts1.x升级到ice.js1.x后,菜单样式缺失 #5523

Closed
Symous opened this issue Nov 2, 2022 · 6 comments
Closed

ice-scripts1.x升级到ice.js1.x后,菜单样式缺失 #5523

Symous opened this issue Nov 2, 2022 · 6 comments

Comments

@Symous
Copy link

Symous commented Nov 2, 2022

What is the current behavior? 发生了什么?

最近将一个老的项目(ice-scripts+@icedesign组件)升级到了ice.js1.x,经过各种各样的兼容性处理,最终成功跑了起来,但是遇到一个棘手的问题,原本的菜单部分(@icedesign/menu)样式缺失导致显示异常,除此其他组件全部显示正常;

原本的样式:
image

升级后的样式:
image

观察到相关的ice-menu样式未加载成功,查找了相关issue及官方文档都没有相关的问题和方案,百思不得其解,请问改如何处理;

What is the expected behavior? 期望的结果是什么?

Any additional comments? 相关环境信息?

  • ice.js Version:1.86.1
  • build.json Configuration
{
    "entry": "src/index.js",
    "alias": {
        "@": "./src/"
    },
    "disableRuntime": true,
    "plugins": [
        "./build.plugin.js",
        [
            "build-plugin-fusion",
            {
                "themePackage": "@icedesign/skin",
                "localization": true,
                "publicURL": "./"
            }
        ]
    ],
    "proxy": {
        
    }
}
  • Node Version: 16.15.0
  • Platform: MacOS 12.4
@ClarkXia
Copy link
Collaborator

ClarkXia commented Nov 2, 2022

@icedesign/menu 比较老的组件,在 icejs 中自动加载样式是通过组件 package.json 中的 stylePath / componentConfig 来决定的,@icedesign/menu 中没看到对应设置,可以先手动导入

@Symous
Copy link
Author

Symous commented Nov 2, 2022

@ClarkXia 抱歉,刚刚issue没写完误点了提交,我补充了一下内容;
没太理解我具体需要怎么做,能不能指点一下,目前除了menu显示异常,其他都是正常的,比如@icedesign/base、@icedesign/container等等,不太了解他们加载样式的逻辑难道还有不同吗,谢谢。

@Symous
Copy link
Author

Symous commented Nov 2, 2022

@ClarkXia 我搜了一下过往的issue,发现之前你们的配置记录日志里面有提到stylePath,我按照里面的demo改造了一下,发现问题解决了。

config
            .plugin('WebpackPluginImport')
            .use(WebpackPluginImport, [[
                {
                    libraryName: '@icedesign/menu',
                    stylePath: 'style.js',
                }
            ]])

@Symous
Copy link
Author

Symous commented Nov 2, 2022

不过我还是没太理解出现这个问题的原因是什么,是ice.js的bug吗。

@ClarkXia
Copy link
Collaborator

ClarkXia commented Nov 3, 2022

@icedesign/menu 比较老的组件,在 icejs 中自动加载样式是通过组件 package.json 中的 stylePath / componentConfig 来决定的,@icedesign/menu 中没看到对应设置,可以先手动导入

上面回复中已经说明原因了

@ClarkXia ClarkXia closed this as completed Nov 3, 2022
@Symous
Copy link
Author

Symous commented Nov 4, 2022

@ClarkXia 后续我又把ice.js升级到了最新的2.6.6,发现一个十分诡异的问题,上面提到的样式引入配置:

config
            .plugin('WebpackPluginImport')
            .use(WebpackPluginImport, [[
                {
                    libraryName: '@icedesign/menu',
                    stylePath: 'style.js',
                }
            ]])

无论怎么改动(比如注释或关闭注释等)都不生效,即使我把dev-server关掉再重启也不行,必须要修改一下build.json才会使其生效,同时我也观察到一个启动速度的差异,只有修改build.json后,才像是”完全重启“了。未排查出具体原因,能不能把这个issue reopen一下。

ps: 该问题在ice1.x不存在;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants