[英]simple npm package not including css code with exported react component
我正在尝试构建一个使用react的小而简单的npm package,但它需要从dist导入css文件,我希望它可以自动导入
那可能吗?
import React from 'react'
import FlyingButton from 'react-flying-item'
import 'react-flying-item/dist/index.css'
const App = () => {
return (
<div>
<img
src='https://lp2.hm.com/hmgoepprod?set=source[/50/8f/508f356497bf61b98794ad904348d4b7599284c2.jpg],origin[dam],category[men_shirts_longsleeved],type[DESCRIPTIVESTILLLIFE],res[m],hmver[2]&call=url[file:/product/style]'
alt=''
/>
<FlyingButton src='https://lp2.hm.com/hmgoepprod?set=source[/50/8f/508f356497bf61b98794ad904348d4b7599284c2.jpg],origin[dam],category[men_shirts_longsleeved],type[DESCRIPTIVESTILLLIFE],res[m],hmver[2]&call=url[file:/product/style]'>
fly
</FlyingButton>
</div>
)
}
export default App
通过使用<style>
标签在 react jsx 中添加 css 代码暂时解决
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.