Open
Description
Currently UMD uses just a static prelude part which looks like
var templateSTR = "(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}defineNamespace()}})(function(){source()});";
as you see amd part in this template looks like define([],f)
But some times modules you are producing depends on other modules,
and if you going to use your modules in AMD environment it should be able to list those dependencies in a define part of a umd template:
define(['dep1', 'dep2'], f);
There is an issue opened for browserify: browserify/browserify#1225
where my last two comments describes in depth why these dependencies should be listed in a define part of umd template.
I think there should be additional options for both cmd and runtime usage like:
umd(name, source, {deps: ['dep1', 'dep2']})
so these dependencies will become a part of a prelude header.
Metadata
Metadata
Assignees
Labels
No labels