blackberry-webworks/BBX-Framework — comment on commit e3505ac273fe37bfafb586a21bfa7dfaea1a3576
File: lib/public/builder.js line 9
By gtanner:

Probably ;)

Welcome to the issue of CommonJS in the browser. This is the main reason a lot of people talk about AMD modules and using that platform in the browser as CommonJS is a little icky.

A cleaner design would be to aspect around require to add in the sync load call if we haven't loaded the module yet. Basically add in this behaviour to browser-require so that we just sync xhr load a module the first time.

A possible issue with requireLocalResource is that I think you are doing an XHR every time someone requires this module now rather than caching the result after the first. This is speculating but is worth a look into the browser-require code to make sure.