Replies: 5 comments 1 reply
-
这个仅仅是 next 与 remix 的特殊设定。并非是 Webpack 或者 rollup 或 vite之类的构建工具所不支持的场景,实际上以上工具都能很好地处理 js import css 的行为(因为业务代码里也是同样这么写的,js module 负责 import 自己所需的 css) 作为 ui library,在 js 中 import 自身对应的css 是非常通用且合理的行为(社区中有非常多的包都是同样的做法),css 会跟随 js 的shaking,这样无需配合构建插件(例如 babel-plugin-import 之类的)来进行 css 文件的按需加载。 我们认为这个是合理的行为,不计划进行变更。 |
Beta Was this translation helpful? Give feedback.
-
ui library里对样式文件的处理,有好几种方案。并非一定是 A 比 B 合理 或者 A 比 B 更优。都存在一些限制。 我们选择 js import css 是因为根据我们的内部用户反馈,大多都不希望还需要手动关注 css 的引入 以及 shaking 问题,使用上的关注负担少了很多。 |
Beta Was this translation helpful? Give feedback.
-
remix 是 react 生态里的一部分,但目前我们更多的用户基数还是来源于普通的项目。针对 remix 项目常规配置无法使用 semi 的问题,我们计划后续像对 next.js 提供支持一样,单独搞个插件来配合使用。 现有的样式引入方式,对于普通 cra / webpack / rollup 是足够友好的。 |
Beta Was this translation helpful? Give feedback.
-
Same here , can't use with Remix, please fix asap, this Library is very nice, make it work on remix! be it in the package or by a plugin.
Thanks |
Beta Was this translation helpful? Give feedback.
-
有没有办法先临时禁止默认加载css这种行为 |
Beta Was this translation helpful? Give feedback.
-
Is there an existing issue for this?
Which Component
ALL
Semi Version
ALL
Current Behavior
在 next 和 remix 中都无法正确处理处理 node_modules 中的代码 import/require css 的行为.
nextjs 官方解释了为何不支持这种行为的理由: https://nextjs.org/docs/messages/css-npm
相关问题 #485
Expected Behavior
不要在发布的 js 代码中包含 import css
Steps To Reproduce
无
ReproducibleCode
Environment
Anything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions