Skip to main content

Posts

Showing posts from April, 2018

JavaScript: Porting from react-css-modules to babel-plugin-react-css-modules (with Less)

I recently found a bug in react-css-modules that prevented me from upgrading react-mobx which prevented us from upgrading to React 16. Then, I found out that react-css-modules is "no longer actively maintained". Hence, whether I wanted to or not, I was kind of forced into moving from react-css-modules to babel-plugin-react-css-modules . Doing the port is mostly straightforward. Once I switched libraries, the rest of the port was basically: Get ESLint to pass now that react-css-modules is no longer available. Get babel-plugin-react-css-modules working with Less. Get my Karma tests to at least build. Get the Karma tests to pass. Test things thoroughly. Fight off merge conflicts from the rest of engineering every 10 minutes ;) There were a few things that resulted in difficult code changes. That's what the rest of this blog post is about. I don't think you can fix all of these things ahead of time. Just read through them and keep them in mind as you follow