r/JavaScriptTips • u/dasher_nick • Dec 06 '22
Building Your First Isomorphic Javascript Library
Writing code in Next.js (or SSR) and need it to run on both the server and client? I recently started working in isomorphic javascript, and it was way more challenging than I originally realized to do it well.
While at DoorDash, I have spent my time focused on building and maintaining two isomorphic javascript libraries: one for analytics, and another for experimentation (e.g. feature flagging, a/b testing). There were times during the process where I began to wonder if the challenges outweighed the benefits. I wrote a blog post here to reflect on the different types of challenges I faced, using a super simple example library to illustrate the points. I hope this guide is helpful to anyone either considering to build an isomorphic javascript, and let me know your thoughts!