My passion lies in creating small, user-friendly TypeScript libraries that can be easily shared among my projects and with the open-source community at large. However, one major obstacle stands in my way:
Time and time again, I run into issues where an NPM module I've developed works perfectly in one environment but encounters strange errors in others. It might function flawlessly in create-react-app, for example, but fail miserably in ts-node. Or it could behave well everywhere except for during the build process, despite being a pure function devoid of context-dependent elements like 'window'.
How can I avoid encountering these frustrating problems?
Is there some sort of "magic" solution that would allow me to test my creations in every conceivable scenario and combination - from browsers to old browsers lacking ES6 support, typescript projects to create-react-app projects, node environments to ts-node instances, ES modules to those imported via require or import statements...?
I yearn for a simple and unified approach to writing code, without having to spend excessive amounts of time configuring and updating (TS, webpack) setups or drowning in boilerplate code.
Imagine having a library that automatically builds for all platforms and inserts the configurations into package.json effortlessly – essentially, a "create-react-app" equivalent tailored specifically for libraries.