We already have a AMD implementation with require.js which is being used for a long time and now team has decided to use r.js optimizer to optimize the build. I am following the steps but I think I am missing something:
We have require.config which looks like the following:
require.config({
waitSeconds : 15,
baseUrl: window.rootPath + 'scripts',
paths: {
jquery: 'empty:',
jqueryui: 'empty:',
recaptcha: '//www.google.com/recaptcha/api/js/recaptcha_ajax',
maxmind: '//j.maxmind.com/app/geoip',
enduser: '/enduser/scripts/system',
cookies: '/enduser/scripts/system/cookies',
errorhandler: '/enduser/scripts/system/errorhandler',
underscore: '/enduser/scripts/underscore',
blockui: '/enduser/scripts/jquery.blockui',
messaging: '/enduser/scripts/system/messaging',
jgrowl: '/enduser/scripts/jquery.jgrowl',
knockout: 'knockout-latest.debug',
kobindings: '/enduser/scripts/system/bindings',
async: 'plugins/require/async',
depend: 'plugins/require/depend',
font: 'plugins/require/font',
goog: 'plugins/require/goog',
image: 'plugins/require/image',
json: 'plugins/require/json',
noext: 'plugins/require/noext',
mdown: 'plugins/require/mdown',
propertyParser: 'plugins/require/propertyParser',
markdownConverter: 'lib/Markdown.Converter'
},
priority: ['jquery']
});
require(["main"]);
Please note that it has CDN paths instead of "empty". But I replaced empty there after reading some threads online. I am running following command on that:
node -o name="filepath" output="output file path"
It's saying tracing dependencies and then it throws an error saying it did not find jquery.js. Any suggestions?
node -o name="filepath" output="output file path" paths.jquery=empty:. This also applies to any CDN that you are using including Jquery.