Answer the question
In order to leave comments, you need to log in
How to get rid of Mismatched anonymous define() error?
Point of entry:
require.config ({
appDir: '../',
baseUrl: 'libs',
urlArgs: "bust=" + (new Date()).getTime(),
paths: {
// Libs
'jquery': 'jquery/dist/jquery.min',
'underscore': 'underscore/underscore-min',
'backbone': 'backbone/backbone-min',
'backbone.babysitter': 'backbone.babysitter/src/build/backbone.babysitter',
'backbone.wreqr': 'backbone.wreqr/src/build/backbone.wreqr',
'marionette': 'backbone.marionette/lib/backbone.marionette.min',
'text': 'text/text',
'json2': 'json2/json2',
'jquery-mousewheel': 'jquery-mousewheel/jquery.mousewheel.min',
'jquery.mCustomScrollbar': 'malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min',
'moment' : 'moment/min/moment.min',
'daterangepicker' : 'jquery-date-range-picker/jquery.daterangepicker',
// Application
'models': '../scripts/models',
'controllers': '../scripts/controllers',
'collections': '../scripts/collections',
'routes': '../scripts/routes',
'views': '../scripts/views',
'behaviors': '../scripts/behaviors',
'templates': '../templates',
'application': '../scripts/app'
},
moment: {
noGlobal: true
},
'jquery.mCustomScrollbar': {
noGlobal: false
},
shim: {
'underscore': {
exports: '_'
},
'backbone': {
deps: ['jquery', 'underscore', 'json2'],
exports: 'Backbone'
},
'marionette': {
deps: ['backbone'],
exports: 'Marionette'
},
'jquery.mCustomScrollbar': {
deps: ['jquery', 'jquery-mousewheel']
},
'jquery-mousewheel': {
deps: ['jquery']
}
}
});
require(['../scripts/main']);
var requirejs = require("requirejs");
var config = {
appDir: "scripts",
baseUrl: "./",
dir: "./build",
modules: [
{
name: "init"
}
],
paths: {
// Libs
'jquery': '../libs/jquery/dist/jquery.min',
'underscore': '../libs/underscore/underscore-min',
'backbone': '../libs/backbone/backbone-min',
'backbone.babysitter': '../libs/backbone.babysitter/src/build/backbone.babysitter',
'backbone.wreqr': '../libs/backbone.wreqr/src/build/backbone.wreqr',
'marionette': '../libs/backbone.marionette/lib/backbone.marionette.min',
'text': '../libs/text/text',
'json2': '../libs/json2/json2',
'jquery-mousewheel': '../libs/jquery-mousewheel/jquery.mousewheel.min',
'jquery.mCustomScrollbar': '../libs/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min',
'moment' : '../libs/moment/min/moment.min',
'daterangepicker' : '../libs/jquery-date-range-picker/jquery.daterangepicker',
// Application
'models': '../scripts/models',
'controllers': '../scripts/controllers',
'collections': '../scripts/collections',
'routes': '../scripts/routes',
'views': '../scripts/views',
'behaviors': '../scripts/behaviors',
'templates': '../templates',
'application': '../scripts/app'
},
};
requirejs.optimize( config, function(results) {
console.log(results);
});
define([
'marionette',
'jquery.mCustomScrollbar'
],
function (MarionetteJS, mCustomScrollbar) {
'use strict';
var app = new Marionette.Application();
app.on('before:start', function() {
$(".table-container, .table-container-pop-up, .search-row").mCustomScrollbar({
theme: 'dark'
});
});
app.on('start', function() {
Backbone.history.start();
});
return app;
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question