Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

Commented Unassigned: Support a CommonJS environment for V8 [45]

0
0
To my understanding, ClearScript V8 does not support the [CommonJS](http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs) standard ([official website](http://www.commonjs.org/)).

My suggestion is to support this.

Alternatively, as you [suggested here](https://clearscript.codeplex.com/workitem/31#PostedByLink1) for the `window` object, is there a way for myself to support the CommonJS API/standard by adding some script and/or host objects?

_(My ultimative goal is to use some 3rd party NodeJS modules inside ClearScript V8 without having to modify their source code to work with ClearScript)_
Comments: Hello! You might be able to adapt an existing CommonJS implementation such as [CommonScript](https://github.com/Localnet/CommonScript). Its [modules.js](https://github.com/Localnet/CommonScript/blob/master/lib/modules.js) file is under 300 lines of well-commented code, and it seems to depend only `location` and `XMLHttpRequest`, both of which can be emulated with host objects. We'll take a closer look. Thanks!

Viewing all articles
Browse latest Browse all 2297