It depends.
While css-modules works fine for private projects, it does not fit good for open source projects. The reason it's because if you use css-modules then you are forcing your library user to set up some extra config.
For open source libraries, I think it's better to use inline styles, because on that way the end user just have to include and use your component. I recommend radium to achieve this.