javascript - RequireJS sugar for main require -


my javascript file starts configuration...

require.config({     baseurl: 'scripts',     paths: {         'code-mirror': 'codemirror/main',         'esprima': 'https://cdn.rawgit.com/jquery/esprima/1.2/esprima',         'jquery': 'http://code.jquery.com/jquery-1.11.2.min',     }, }) 

...and requires...

require( ['jquery', 'code-mirror', 'profile', 'feedback', 'browser-detect'], function($, codemirror, undefined, feedback, browser){ 

...and works! now, attempted use sugar syntax instead, so...

require( function(require){  var $ = require('jquery'),     codemirror = require('code-mirror'),     undefined = require('profile'), // functions bound window     feedback = require('feedback'),     browser = require('browser-detect'); 

...and not work! why? thank you!

the commonjs sugar syntax available define, not require.

if @ source code of requirejs, regular expression named cjsrequireregexp. regular expression used deal commonjs syntax. search occurrences: you'll see used define.


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -