I know that immigrants to the United States holding a H4 visa are not allowed to work. But there is a grey area that I could never find a satisfactory answer to: what if a H4 holder works remotely, doing a purely intellectual work (let's say, translation or software development) as a contractor for their home country? In this case, the American economy is never touched and the worker does not have any employee relationship with their clients. Does that qualify as "work" for the US government?
There is some debate on the issue, but the consensus is that you can't work while you're in the US independently of where the company you work for is located.
This article explains this:
But the grumble of many job-ready H4 visa holders is that they’re also banned from working remotely for companies back in their home nation. Freelancing, or even continuing to run a business abroad with no trading links to the U.S., would be a violation of the terms of the H4.
And there can be found similar explanation in a lot of places, like this one:
The reality is that the laws regulating H-4 status do not not necessarily contemplate a person working remotely but the existing laws explicitly state that a H-4 dependent cannot work unless he or she is the approved beneficiary of an authorized petition and been granted a change of status to a non-immigrant category.
So the answer is: you can't legally work - even if its remote work for a foreign company or freelancing.
There might be however some ways how you can still earn a little income.
The issue is not work but income.
For example an H4 can own a business so as long as your US business does not pay you. Same would likely go for any other work performed outside the US. But to be safe they would have to hire your company rather then you directly.
But I would strongly recommend getting in touch with an immigration lawyer to see exactly how far you can take this.