requirejs / almond

A minimal AMD API implementation for use after optimized builds
Other
2.42k stars 168 forks source link

Is there a way to remove the missing dependency while building modules? #89

Closed zjleon closed 10 years ago

zjleon commented 10 years ago

Hi, I want to build two version of script for both old browser and modern browser, so i put some code support IE into a file 'oldbrowser.js', and when i build all modules for modern browser with grunt, i use these config:

options:{
  exclude: 'oldbrowser.js'
}

Then combined the built file with almond, and i get error 'http/request missing oldbrowser'. What i write in module http/request is something like below:

define(function(){
 if(isOldBrowser){
  require('oldbrowser');
 }
});

Thx for help.

jrburke commented 10 years ago

I would use the stubModules config to just enter a stub entry for that module:

stubModules: ['oldbrowser']

That way the if(isOldBrowser) test is not needed.