Authoring Notes and Warnings
.coffee
, `.coco', '.iced', & '.ls' files are valid javascript source modules. All modules are compiled and parsed only as javascript; Module generation is again just javascript. If you want to have more compiled-to-javascript languages as source modules, its VERY easy: you dont need a a plugin, just declare it on bundle.resources.Your
require
s should use a string, egrequire('myModule')
. Requires that evaluate at runtime, egrequire(myVar + 'module')
can't be possibly be evaluated at parse time and thus are unsafe at runtime - dont worry you'll get a warning.Your module
define(..)
must be a top level in your .js (not nested inside some other code), with the exception of the safety wrapper(function(){...}).call()
that coffeescript & family is generating.Everything outside
define
is simply ignored, again with the exception of the safety wrapper in which case the statements before the define are correctly added to the generated modules.Only one
define()
module per file is expected - you 'll get a compiled error if more than 1 is found.Each generated module has 3 convenience variables that detect the runtime environment:
__isAMD
,__isNode
&__isWeb
. They can be ommitted through thebuild.runtimeInfo
flag.You can use the
.js
extension (but why?) on your dependencies (egrequire('../mylib.js')
, as it is allowed by nodejs. Because of the different semantics in RequireJS, its fixed(i.e stripped) by uRequire ONLY if not really needed (i.e it exists on your bundle dir). Otherwise its NOT stripped.Comments are ignored, its the parser used - for other possible parsing limitations consult esprima.
You can use the nodejs
require('./some/dirName')
that is converted torequire('./some/dirName/index')
so it works on AMD / UMD. It needs'index.js'
(or'index.coffee'
,'index.iced'
etc) to be present inside'./some/dirName/'
directory.
- Using & Configuration
- Using uRequire
- MasterDefaultsConfig.coffee
- ResourceConverters.coffee
- Types and Derive
- Tags Legend
- CLI Options
- Module Authoring
- Universal Module Format
- Flexible Path Conventions
- Synchronous Require
- Asynchronous Require
- Exporting Modules
- Mappings
- RequireJS Loader Plugins
- Authoring Notes and Warnings
- Deployment
- Conversion Templates
- UMD Template
- AMD Template
- nodejs Template
- combined Template
- your-custom Template