Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple modules in "preload module" #230

Closed
webpro opened this issue Sep 23, 2013 · 4 comments
Closed

Multiple modules in "preload module" #230

webpro opened this issue Sep 23, 2013 · 4 comments

Comments

@webpro
Copy link
Contributor

webpro commented Sep 23, 2013

When there are multiple define() calls in a bundle, configured to be preloaded in preloads, I'm getting no output at all.

But when using the same modules as a regular dependency, it works fine.

Say, this is preloadLib.js (bundled, so named modules):

define('a', function(){
    return 'a';
});

define('preloadLibs', ['a'], function(){
    return 'preloadLibs';
});

..then this fails:

curl.config({
    preloads: ['preloadLibs']
});

define('b', function(){
    return 'b';
})

curl(['b'], function() {
    console.log(arguments);
});

..while this is OK (without the preloads config):

curl(['preloadLibs','c'], function(b, c) {
    console.log(arguments);
});

Not getting any output from the failing case (also not with an errback).

So, I was wondering whether this difference in behavior is on purpose? I thought I should be able to preload a built bundle.

@unscriptable
Copy link
Member

Hey @webpro,

I hadn't considered this case at all. Still, I'm a bit surprised it doesn't work (and gives no error indication).

I may have some time soon to dig in to see what's happening, but I really would like to wait until I've refactored curl. Are you ok with a not-pre-bundled-preload solution for now?

-- John

@webpro
Copy link
Contributor Author

webpro commented Oct 3, 2013

Thanks @unscriptable.

I'd rather wait for a next version, as this kinda ruins the curl setup in our project (gist + #216). No hard feelings, but I simply stick to require.js until I can finish the migration to curl. Unbundled preloads is an option of course, but a hassle to setup and probably undoes any performance gains.

I'm also willing to dig into curl myself for this, but it sounds like the refactoring is a serious one..?

@unscriptable
Copy link
Member

Curious: why would unbundled preloads be a hassle or performance problem? cram.js will bundle them into a single file along with the app's non-preload modules.

@webpro
Copy link
Contributor Author

webpro commented Oct 3, 2013

  • Not using cram here.
  • It's not one app (but a "core" for various apps/teams).
  • This would require a refactoring now, and another one later on.
  • The preloads are conditional (cujojs/poly, debug).
  • Unbundled == more requests.

@webpro webpro closed this as completed Oct 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants