Replacing code for production with Babel transformation

If you are building some sort of an app, Babel is probably part of your build system. It is that thing which converts our fancy code to valid, working in a browser, JavaScript. Just recently at work I had to design a solution that swaps a class based o…


This content originally appeared on Krasimir Tsonev - blog and was authored by Krasimir Tsonev - blog

If you are building some sort of an app, Babel is probably part of your build system. It is that thing which converts our fancy code to valid, working in a browser, JavaScript. Just recently at work I had to design a solution that swaps a class based on the environment. Or in another words, we have logic that should not reach our users. The file should be available locally and on our staging environment but not in production. A tiny Babel plugin was the cheapest solution for me so I decided to share the result.


This content originally appeared on Krasimir Tsonev - blog and was authored by Krasimir Tsonev - blog


Print Share Comment Cite Upload Translate
APA
Krasimir Tsonev - blog | Sciencx (2023-01-27T02:04:31+00:00) » Replacing code for production with Babel transformation. Retrieved from https://www.scien.cx/2021/02/07/replacing-code-for-production-with-babel-transformation/.
MLA
" » Replacing code for production with Babel transformation." Krasimir Tsonev - blog | Sciencx - Sunday February 7, 2021, https://www.scien.cx/2021/02/07/replacing-code-for-production-with-babel-transformation/
HARVARD
Krasimir Tsonev - blog | Sciencx Sunday February 7, 2021 » Replacing code for production with Babel transformation., viewed 2023-01-27T02:04:31+00:00,<https://www.scien.cx/2021/02/07/replacing-code-for-production-with-babel-transformation/>
VANCOUVER
Krasimir Tsonev - blog | Sciencx - » Replacing code for production with Babel transformation. [Internet]. [Accessed 2023-01-27T02:04:31+00:00]. Available from: https://www.scien.cx/2021/02/07/replacing-code-for-production-with-babel-transformation/
CHICAGO
" » Replacing code for production with Babel transformation." Krasimir Tsonev - blog | Sciencx - Accessed 2023-01-27T02:04:31+00:00. https://www.scien.cx/2021/02/07/replacing-code-for-production-with-babel-transformation/
IEEE
" » Replacing code for production with Babel transformation." Krasimir Tsonev - blog | Sciencx [Online]. Available: https://www.scien.cx/2021/02/07/replacing-code-for-production-with-babel-transformation/. [Accessed: 2023-01-27T02:04:31+00:00]
rf:citation
» Replacing code for production with Babel transformation | Krasimir Tsonev - blog | Sciencx | https://www.scien.cx/2021/02/07/replacing-code-for-production-with-babel-transformation/ | 2023-01-27T02:04:31+00:00
https://github.com/addpipe/simple-recorderjs-demo