Задать вопрос
ogarich89
@ogarich89
Front-End Developer

Как избавиться от ошибки Mismatched anonymous define()?

Точка входа:
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);
});


Ошибка возникает c плагином jQuery mCustomScrollbar

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;
})
  • Вопрос задан
  • 789 просмотров
Подписаться 1 Оценить Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы