create-react-library
create-react-library copied to clipboard
Module not found: Can't resolve XXXX.css
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
Hi,
Have you tried to first remove package-lock.json, node_modules and then use Yarn ?
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.
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
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 :)
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 :(
Oops! Looks like in the meantime you should switch to NPM )
Unfortunately :( Thanks for your help and your great work.
NPM also I am getting same error :-(. CSS not loading
@DimiMikadze I am using npm, but still i had the same issue.