You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the readme it is said, that almond supports plugins (like text and cs), but then the recommended use case is to bundle everything into one file and inline plugin resources, and stub out actual plugins, which means there is actually no need for "plugin support", because when you say require(["cs!foo"]) it gets the code after define(["cs!foo"]...) and doesn't care about cs plugin.
So if I have all my modules written in coffee, and I've split them into two: first and second (modules in r.js build.js), where second is required dynamically on user interaction, how am I supposed to do it?
If I use something like require(['cs!second'], function(second) {..}), then it will search for cs plugin, which in turn will download coffee file, which is not optimal for production. I guess using a javascript bootstrap file for each module (in r.js) would solve that problem. But then I need full blown requirejs just for prepending baseUrl and fetching a script (because almond can't fetch).
The text was updated successfully, but these errors were encountered:
almond cannot dynamically load code so trying to dynamically load the 'two' bundle will fail regardless if a loader plugin is used. If you want dynamic loading, bundle requirejs instead. An example, which shows how to map 'require' to 'requireLib' so it can be properly inlined in the build is in the second example here:
If second is already included with the built file with almond and no dynamic code loading is needed, just a dynamic require for it some time later, then what you can do for loader plugins that you just want a stub value for, you can use the stubModules config when using r.js to combine the files together:
In the readme it is said, that almond supports plugins (like text and cs), but then the recommended use case is to bundle everything into one file and inline plugin resources, and stub out actual plugins, which means there is actually no need for "plugin support", because when you say
require(["cs!foo"])
it gets the code afterdefine(["cs!foo"]...)
and doesn't care aboutcs
plugin.So if I have all my modules written in coffee, and I've split them into two:
first
andsecond
(modules
in r.js build.js), wheresecond
is required dynamically on user interaction, how am I supposed to do it?If I use something like
require(['cs!second'], function(second) {..})
, then it will search for cs plugin, which in turn will download coffee file, which is not optimal for production. I guess using a javascript bootstrap file for each module (in r.js) would solve that problem. But then I need full blown requirejs just for prependingbaseUrl
and fetching a script (because almond can't fetch).The text was updated successfully, but these errors were encountered: