This is how I feel now with web development, because now that I know the React and tools to handle a React code base, I can easily create a very specialized framework that can enhance the developer productivity of a web developer team.
We have seen quite a few frameworks on top of React and all of these innovate and differentiate in their offerings for developers. It wasn't easy to reach this comfort level. When I decided to create a full stack framework, it took me more than a month to just understand the tooling ecosystem around React or JavaScript type script in general. This was even harder because I had to dive a bit into the history of JavaScript type script and how they came to be. I landed upon React's design philosophy which motivated me to write down philosophies for the framework.
It has really helped me in deciding two major categories of tools that our framework should use. Those are bundler and transpiler. More on this later. Once we had pinned these down, then only we can move to development of the framework. When we think of a framework, we quickly start to think that they provide abstraction, helper functions, components, server side rendering, server side generation, etc. We take many other things for granted. For example, how are we handling different JavaScript syntax and type script all in one code base? How are we able to import non-JavaScript typescript files in JavaScript typescript files? For example, we import image files as string URLs, and VG as React components, etc. These have become the de facto standards for a good developer experience in any framework.
This is made possible by tools like compilers, transpilers, bundlers, formatters, and linters. Rendering on the server side is a common requirement for most of the frameworks, if not all. Hence, our framework has to support React in both browsers and Node.js. In other words, it becomes crucial to realize the difference between different module types, especially ECMAScript and common.js. When we think about what bundler and build tools to use, we mostly think in terms of how fast they run. But as a framework creator, you might have to think more about your requirements. For example, if the developer's experience entails code mods, then you might prefer something like Babel over ESBuild because Babel exposes AST to load as plugins, while ESBuild doesn't. We're using Webpack and Babel together at a 3 framework.
A 3 framework allows developers to write plugins etc. where JavaScript modules are treated as different resources. We needed a way so that one resource can point to another resource. One way could have been that you write the path to a module you want to point as in the first statement you see here. It has several drawbacks. While the developer is writing or typing the code, the developer won't get any intellisense and no checks at build time. To circumvent these, we are using a feature from Webpack called resource query that we can add at the end of the import path as you can see in the second example. In the second example we are able to offer good intellisense and build time checks.
Comments