There isn't a way to disable that currently - right now, we always emit support for all environments in each build: node.js, other js shells, web, and web worker. Those require() calls are in the support code for node.js.
However, we do have a way to set the environment at runtime, using Module['ENVIRONMENT'] (src/shell.js). Perhaps we could add an option to do that at compile time, and then ifdef out the other environments. On Fri, Oct 21, 2016 at 3:23 PM, Klaus Reimer <[email protected]> wrote: > Hi, > > I compiled some simple C library to JavaScript and I'm trying to load the > library with SystemJS in the browser but this fails because SystemJS > detects two require() calls in the compiled library: > > if (!nodeFS) nodeFS = require('fs'); > if (!nodePath) nodePath = require('path'); > > SystemJS doesn't check if the code is actually executed, it just scans the > file for the existence of these requires so the files can be asynchronously > loaded before executing the emscripten code. Naturally this fails because > there are no "fs" and "path" modules in the browser. > > The require() calls are used in the automatically generated read() > function. I manually removed this function from the code and the library is > still working and can now be loaded with SystemJS successfully. > > Which feature needs this function? Can I disable it somehow? I tried > setting NO_FILESYSTEM=1 but unfortunately this function is not affected by > it. > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
