Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Better process and Buffer detection #55

Open
guybedford opened this issue Apr 9, 2015 · 4 comments
Open

Better process and Buffer detection #55

guybedford opened this issue Apr 9, 2015 · 4 comments
Labels

Comments

@guybedford
Copy link
Member

See jspm/jspm-cli#655, we need to be better detecting the process and Buffer identifiers for wrapping.

@lookfirst
Copy link

Right. In one of the comments you mentioned using https://github.com/substack/insert-module-globals which seems like it is a good idea since it uses a parser instead of a regex.

@guybedford guybedford changed the title Better process detection Better process and Buffer detection Apr 19, 2015
@guybedford guybedford added the bug label Apr 19, 2015
@guybedford
Copy link
Member Author

The hard part about this one is we should really be sharing the parse tree with the remap function calls which does a synchronous parse as well.

One simple way might be to have a cache in the builder implementation, but better would be to load Traceur as a direct dependency and simply share the remapping CommonJS transformer with the builder project, and remove the exports.remap function entirely in SystemJS builder.

@intellix
Copy link

This also seems to happen for isomorphic scripts that work in both Node and Browser like ZoneJS.
Example: https://github.com/angular/zone.js/blob/master/dist/zone.js#L745

exports.isNode = (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]');

Was hoping to use JSPM in angular-cli, which uses Zone amongst a few other items, but they're all getting wrapped in require('process') so it seems impossible at the moment.

@guybedford
Copy link
Member Author

@intellix if you use jspm 0.17 you can avoid the wrapping as it does it through editable config then instead.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants