Memory profiler not enabled with node-browser-libs
FYI
0715061d4b17695fac2fe2f4ae79194f7d84cebb seems to break the usage of the memory profiler if node-browser-libs is also used, since process will not be undefined.
I've hacked that condition out in my local copy and it seems OK, but I don't know what it was added so can't comment further really!
Regards
Luke.
cc @juj who wrote that commit
The idea there is to prevent memoryprofiler from being attempted to be loaded if not running in browser. The problem with the other tests were that the generated code polyfilled mock window etc. objects, so I added an explicit node check with process. If you have a more precise suggestion for a feature test, feel free to submit a PR - flexible to changing that so it works for your scenario.
Well process.browser === true with node-browser-libs so I guess (typeof process === "undefined" || process.browser) should do the trick - #7559. Looks OK to me in a browser and node anyway!
As an aside, I notice enabling cpuprofiler won't work in node as there's no runtime check on performance. I could probably find some time to look at that if it's something you'd like?
And as a further aside, locally I add in another check for an enable flag for both, something like...
if (typeof Module !== 'undefined' && typeof document !== 'undefined' && typeof window !== 'undefined' && (typeof process === 'undefined' || process.browser) && ((typeof Module.enableMemoryProfiler === 'undefined') || Module.enableMemoryProfiler)) emscriptenMemoryProfiler.initialize();
so I can build with --memoryprofiler --cpuprofiler but still disable it without having to get emscripten involved again. (Obviously a final production build of anything wouldn't enable the switches in emscripten...)
Can PR that too if it's of interest.
Regards
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.