requirejs

Kendo Modules and RequireJS (r.js) not playing nice. (Error on loading)

旧城冷巷雨未停 提交于 2019-12-07 17:17:14
问题 I am using Kendo UI version 2013.1.514 and RequireJS ( r.js version 2.1.6 ) My project runs perfectly under the standard RequireJS on-demand loading. However, when I try to use the optimizer, none of the Kendo will load. Including any of them gives the famous-and-irritation Uncaught Error: Mismatched anonymous define() module: error. This is my configuration: { "baseUrl": "../Scripts", "name": "../Scripts/js_modules/base_module.js", "include": [], paths: { k: "Frameworks/kendo-2013.1.514

Use jQuery as a dependency without loading jQuery with RequireJS?

江枫思渺然 提交于 2019-12-07 16:31:19
问题 Consider the following page: <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script> </head> <body> <script data-main="app" src="require.js"></script> </body> </html> How can i use jQuery as a dependency for RequireJS modules when it's not loaded with RequireJS? I know jQuery exposes itself as a global AMD module, so i should be able to add it as a dependency, but i'm not quite sure how to. I would like to be able to do the following: require(['jquery'],

Front end javascript testing using Require and Resharper

浪子不回头ぞ 提交于 2019-12-07 15:54:28
So I've been trying to figure out how front end testing works (unit testing) but I am getting stuck on some point. So I have my jasmine test set up as follows: describe('Blabla', function () { it('returns true', function () { var people = require(["people"], function(ppl) { return ppl; }); expect(people.getTitle()).toBe('People piolmjage'); }); }); But running this gets me: TypeError: undefined is not a funtion So obviously, people is undefined. So perhaps my callback comes in too late. But if I remove the callback I get following error: it('returns true', function () { var people = require(

Visual Studio 2010 intellisense for KnockoutJS inside RequireJS

老子叫甜甜 提交于 2019-12-07 13:13:27
问题 I want to get intellisense, inside Visual Studio 2010, for knockoutJS. What I have after some research is: ///reference path="../lib/knockout/knockout-2.3.0.debug.js" /> ko.WeGotIntellisenseHere; //As long as we don't add RequireJs intellisense reference above knockout reference define(['jquery', 'knockout'], function($, ko){ ///<param name="ko" type="knockout"> ///some comments ///</param> ko.NoIntellisenseHere(); // unless I change "type=knockout" by "type=Array" }); Do you know if maybe

RequireJS not loading modules properly using karma and typescript

无人久伴 提交于 2019-12-07 11:32:00
问题 I am trying to set up unit testing for a SPA using karma/jasmine First of all, the following test runs just fine in karma: /// <reference path="../../definitions/jasmine/jasmine.d.ts" /> /// <reference path="../../src/app/domain/core/Collections.ts"/> define(["app/domain/core/Collections"], (collections) => { describe('LinkedList', () => { it('should be able to store strings for lookup', () => { var list = new collections.Collections.LinkedList<string>(); list.add("item1"); expect(list.first(

handlebars in requirejs load not successfully

你说的曾经没有我的故事 提交于 2019-12-07 11:11:03
问题 paths: { jquery: 'libs/jquery/jquery-min', underscore: 'libs/underscore/underscore-min', backbone: 'libs/backbone/backbone-optamd3-min', handlebars: 'libs/handlebars/handlebars', text: 'libs/require/text' } define([ 'jquery', 'underscore', 'backbone', 'collections/todos', 'views/todos', 'text!templates/stats.html', 'common', 'handlebars' ], function ($, _, Backbone, Todos, TodoView, statsTemplate, Common, handlebars) { //handlebars is null console.log("handlebars is",handlebars); }) Except

Using RequireJS with legacy code

岁酱吖の 提交于 2019-12-07 11:02:14
问题 I'm working with a very large project that uses: Legacy JSP pages that includes javascript files with script tags Backbone models and views that uses other javascript modules without RequireJS We now want to start using RequireJS with jQuery, BackboneJS and UnderscoreJS for everything we develop from now on, but we don't have the resources to rewrite all the legacy JSP pages. We may have time to rewrite the Backbone models and views we have already developed. The problem is that for our

Using OpenLayers with RequireJS and AngularJS

瘦欲@ 提交于 2019-12-07 07:58:52
问题 I'm trying to get an app running that uses both AngularJS and RequireJS. I'm having problems getting my OpenLayers lib to work in this setup. I set the main AMD-modules in the main.js: require.config( { baseUrl: 'scripts', paths: { // Vendor modules angular: 'vendor/angular/angular', openLayers: 'vendor/openlayers-debug', other modules..... }, shim: { angular: { exports: 'angular' }, openLayers: { exports: 'OpenLayers' }, other modules.... } } ); require(['openLayers', 'angular', 'app',

Using requirejs with dojo 1.9.1

不问归期 提交于 2019-12-07 07:51:45
问题 Can anybody provide me with a simple example of how to use requirejs to load dojo modules? The requirejs.org website indicates it is best to use the dojo loader until a ticket is resolved - but that ticket appears to be resolved and is now closed. I am encountering errors such as described here (duplicated below) only now with dojo 1.9.1. Error: TypeError: _3.add is not a function _3.add("dom-addeventlistener",!!document.addEventListener); (I have an existing backbone app that uses requirejs

bootstrap-datepicker not getting shimmed with requirejs

。_饼干妹妹 提交于 2019-12-07 07:45:56
问题 I am building a application with backbone.js + require.js. I want to use datepicker from here in my application: datepicker Since its non-AMD, i shim it in requirejs like this: require.config({ baseUrl: "appjs", paths:{ jquery: '../layout_assets/assets/js/libs/jquery-1.8.2.min', dt: '../layout_assets/plugins/datatables/jquery.dataTables.min', dtPlugins:'../layout_assets/plugins/datatables/dtplugins', dtBootstrap: '../layout_assets/plugins/datatables/dataTables.bootstrap', underscore: '..