Well, sure it's possible, but to be honest there are more heavy part we should discuss to remove to have more free heap and figure out why the firmware has less heap with each esp-idf update.
My first test results with esp-idf 4.1 based on JumJum's work to make it happen is
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
You mean, move it from firmware to javascript?
Well, sure it's possible, but to be honest there are more heavy part we should discuss to remove to have more free heap and figure out why the firmware has less heap with each esp-idf update.
My first test results with esp-idf 4.1 based on JumJum's work to make it happen is
and it is missing TLS at the moment.
Have you used EFEU? It is an online firmware build tool maintained by JumJum which allows to build a firmware with stuff you need for your project.