gatewaycash / gateway

Gateway - Simple Bitcoin Payments
GNU Affero General Public License v3.0
18 stars 10 forks source link

Stop using @babel/node in production #157

Closed ty-everett closed 4 years ago

ty-everett commented 4 years ago

Using @babel/node in production for the backend is slow and not recommended. We should either convert to commonJS (favorable because it allows NODE_PATH and cleaner imports) or the experimental ES6 in node (favorable because it allows us not to convert all the backend code over to commonJS, but messes up the pretty imports.

Ideally, we would find a way to use ES6 with the same imports as we have now, but I am not sure how to do this. It would be easier because the changes needed to backend code would be minimal-to-none. If anyone knows of a good solution to this, please don't hesitate to leave a comment :)

ty-everett commented 4 years ago

@ZacxDev made a good suggestion here (I will probably be the one to end up implementing this but I want to document it so I don't forget).

We can substitute @babel/node (which is not production safe) for ts-node, which is. We can then create a tsconfig.json and allowJs.

Eventually, to improve runtime performance, we can compile the backend before running it with vanilla node. At that point we should be able to keep all our code the same while getting away from babel and adding some cool extra features to the backend as an added bonus!