I am using the requirejs optimizer to minimize my modules into a single file for production. However, I want to exclude jQuery from the file so that it can be downloaded separately from the real application logic, how can I achieve this? I tried to configure this with the exclude and excludeShallow parameters, but when I start the page, I get the following error:
Untrained ReferenceError: jQuery undefined app.min.js: 14 (anonymous function) app.min.js: 14
My grunt configuration for requirejs looks like this:
requirejs: {
minify: {
options: {
baseUrl: 'js',
mainConfigFile: 'js/main.js',
name: 'main',
out: 'js/app.min.js',
excludeShallow: [
'jquery'
]
}
}
}
Many thanks!
source
share