javascript - RequireJS optimizer with coffeescript -


i'm running on severals issues when i'm trying run node requirejs on project.

this folder structure :

-root     -/src         -app.coffee      -/static         -/vendor             -/plugin                 -r.js                 -coffee-script.js              -/lib                 -jquery.js              -main.js      -build.js 

this build.js file :

({     appdir          : './',     baseurl         : './static/js/',     dir             : '../public',     optimize        : 'uglify',     exclude         : ['coffee-script'],     stubmodules     : ['cs'],      paths: {          // libraries          'modernizr'     : 'vendor/modernizr',         'jquery'        : ['//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min', 'vendor/jquery'],         'jqueryui'      : 'vendor/jquery-ui',         'backbone'      : 'vendor/backbone',         'underscore'    : 'vendor/underscore',          // plugins          'plugin'        : 'plugin/plugin',          // requirejs          'cs'            : 'plugin/cs',         'coffee-script' : 'plugin/coffee-script'      },     shim: {          'jqueryui' : ['jquery'],          'underscore': {             exports: '_'         },          'backbone': {             deps: ['underscore', 'jquery'],             exports: 'backbone'         }     },     modules: [{         name: "main"     }] }) 

and main.js file :

require({   baseurl   : '../../src/',   paths: {     cs: '../../cs',     'coffee-script': '../../coffee-script'   } }, ['cs!app']); 

i'm getting error related incorrect path setting , can't figured out i'm wrong.

thanks !

the solution below worked in case. it's common issue non-amd modules imported shim or wrapped manually (for instance this one, custom paths).

try avoiding relative paths , use absolute 1 paths instead. dependency called aliased module use current location find required module.

require.config( {   locale: window.gis.i18n.locale,   deps: ['cs!modules/main'],   paths: {     'i18n'                       : 'i18n',     'underscore'                 : 'libs/underscore',     'cs'                         : 'libs/cs', // there's no '../something/else/libs/cs'     'coffeescript'               : 'libs/coffeescript', // ibidem.     'text'                       : 'libs/text',     // ... other amd module aliases go here...   },    shim:{   // ...   }  });  define(['cs!modules/main'], function(){}); 

1 of course, these not absolute paths per se, relative root of module tree.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -