create-react-library icon indicating copy to clipboard operation
create-react-library copied to clipboard

Module not found: Can't resolve XXXX.css

Open alb3ric opened this issue 7 years ago • 9 comments

Hello,

I'm using create-react-library to build a react package. My package has a css file and is host in a gitlab repository. If I'm installing (or upgrading) my package with "npm install git+http://urlrepository" the package is referenced and build sucessfully (js + css). Same if i m running npm install to reinstall all dependencies. But if i m using yarn (yarn add), the package is build (apparently js and css are created) but the css file doesntt appear in the node_modules directory. and I got this error when laucnhing : Module not found: Can't resolve XXXX.css, which is normal because the css is not in the node_modules directory.

Do you have any clue why my library is acting like this?

Thanks in advance!

Alberic

alb3ric avatar Jul 02 '18 10:07 alb3ric

Hi,

Have you tried to first remove package-lock.json, node_modules and then use Yarn ?

DimiMikadze avatar Jul 03 '18 06:07 DimiMikadze

Hello,

Thanks for your answer.

I tried with yarn after removed node_modules, but not sure i tried after removing package-lock.json. I m away for two weeks, I love try when I m back. But don't think it work. When I use yarn, it s building my library , and it s displaying in the terminal that my js and CSS are built but o can't see the CSS in the node_modules folder.

Keep you in touch.

alb3ric avatar Jul 03 '18 07:07 alb3ric

Hello, I'm back. I just gave a try removing package-lock.json and node_modules (i even clean yarn cache) but it is still the same result. In the terminal during yarn I have this :

[4/4] Building fresh packages...
$ node scripts/build.js
Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  85.92 KB  dist\index.js
  426 B     dist\css\theme.css

the folder generated in node_modules i just get /dist/index.js but no directory css with the file theme.css in it. If I then call npm install, the css directory and the theme.css appear.

Do you have any clue?

Regards

Alberic

alb3ric avatar Jul 20 '18 09:07 alb3ric

Hi,

Maybe you've got some yarnignore file, that is ignoring css folder? :)

Can't think anything else, let's leave it open, maybe someone also had similar issue and knows the answer :)

DimiMikadze avatar Jul 23 '18 07:07 DimiMikadze

Hello!

Just found this opened issue in the yarn repositories : https://github.com/yarnpkg/yarn/issues/1671

seems to relate my problem, but no fix yet :(

alb3ric avatar Jul 23 '18 07:07 alb3ric

Oops! Looks like in the meantime you should switch to NPM )

DimiMikadze avatar Jul 23 '18 11:07 DimiMikadze

Unfortunately :( Thanks for your help and your great work.

alb3ric avatar Jul 23 '18 11:07 alb3ric

NPM also I am getting same error :-(. CSS not loading

senthilraj avatar Aug 19 '18 20:08 senthilraj

@DimiMikadze I am using npm, but still i had the same issue.

Vishal1419 avatar Jan 28 '19 11:01 Vishal1419