Alon,

Is that still the case with the latest release of the tool? .. ie, there is 
no way to build a module that doesn't include a require() to 
nodejs component. I am working with the latest version of webpack and it 
sees that require and wants to bring in things that are not needed in a 
browser environment.

I am not sure I understand your comment about "using Module['ENVIRONMENT'] 
". 

Regards,
Joe

On Monday, October 24, 2016 at 1:45:31 PM UTC-5, Alon Zakai wrote:
>
> 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] <javascript:>
> > 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.
>>
>> t <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.

Reply via email to