Home > OS >  simple npm package not including css code with exported react component
simple npm package not including css code with exported react component

Time:09-29

I'm trying to build a small and simple npm package that uses react, but it needs to import the css file from the dist, And I would like it to auto import it with the export

is that possible?

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

CodePudding user response:

Temporarly solved by adding the css code in react jsx by using <style> tag

  • Related