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
Post a Comment