requirejs

Why do concatenated RequireJS AMD modules need a loader?

我与影子孤独终老i 提交于 2019-12-20 08:28:19
问题 We love RequireJS and AMD during development, where we can edit a module, hit reload in our browser, and immediately see the result. But when it comes time to concatenate our modules into a single file for production deployment, there apparently has to be an AMD loader still present, whether that loader is RequireJS itself or its smaller partner “almond” as explained here: http://requirejs.org/docs/faq-optimization.html#wrap My confusion is: why is a loader necessary at all? Unless you have

Loading jQuery, Underscore and Backbone using RequireJS 2.0.1 and shim

╄→гoц情女王★ 提交于 2019-12-20 08:01:07
问题 I am experimenting a little bit with RequireJS 2.0.1 . My goal is to load correctly jQuery, Underscore and Backbone. From the original RequireJS doc I discovered that the author J. Burke added (to this new release) a new config option called shim. Then I wrote this stuff down here: index.html <!DOCTYPE html> <html> <head> <title>Testing time</title> <script data-main="scripts/main" src="scripts/require.js"></script> </head> <body> <h1>Testing time</h1> </body> </html> scripts/main.js

Loading multiple instances of requireJS and Backbone

做~自己de王妃 提交于 2019-12-20 05:47:26
问题 I am creating a google chrome extension which, when activated on a tab, loads some custom code and a few new views into the document of that window. I'd like to use requireJS to load these new modules of code called by the extension. However, I worried about a possible conflict or name collision that might occur if the app/website this extension is called on is already running requireJS, and my calling it from scratch either wipes the sites native require.config or otherwise causes some

AlmondJS - Require external url

独自空忆成欢 提交于 2019-12-20 05:37:45
问题 In one of my AMD modules I have require(["//google-analytics.com/analytics.js"]); It works with requireJS, but, when using almond, I get "Uncaught Error: undefined missing //google-analytics.com/analytics.js" error. Does this mean almond does not support requiring external scripts? 回答1: Does this mean almond does not support requiring external scripts? Yes, that's exactly what it means. From the "Restrictions" section , very first item: optimize all the modules into one file -- no dynamic

requirejs angular doesn't seem to register controller / services / etc

人走茶凉 提交于 2019-12-20 05:22:22
问题 I have a very simple requirejs and angular demo app. When I run the code, it's as if angular doesn't register the homeController (even tho the file does run and outputs "Hello from home controller"). It's frustrating to get little to no debug info on how to solve this. Any help would be greatly appreciated! On my local machine, I am getting this error message: "Error: [ng:areq] Argument 'HomeController' is not a function, got undefined" On Plnkr I am getting a different message: Error: [ng

Difference between “Q” and “q” in angularjs and requirejs

六眼飞鱼酱① 提交于 2019-12-20 03:12:07
问题 I am creating a single page app built on AngularJS, Breeze, and RequireJS. In setting up AMD with requirejs to work with Angular and Breeze, I encountered an issue with Breeze's dependency on "q". If the configuration rule for "q" is lowercase, even if there is no explicit export in the "shim", Breeze gives this error: Uncaught Error: Unable to initialize Q. See https://github.com/kriskowal/q "http://localhost:1498/Scripts/shared/breeze.js"breeze.js:1` When require config changes all

requirejs with angular - not resolving controller dependency with nested route

依然范特西╮ 提交于 2019-12-20 03:00:35
问题 The RequireJS is not resolving dependency properly when the routes is of multiple levels as in http://www.example.com/profile/view . If I just have http://www.example.com/view , the controller dependency is resolved properly. My bootstrap.js require.config({ baseUrl : 'res/js', paths: { routeResolve: 'routeResolve', 'domReady': 'lib/domReady', angular: 'lib/angular', angularRoute: 'lib/angular-route', angularResource: 'lib/angular-resource', angularSanitize: 'lib/angular-sanitize', cssPath :

RequireJS with jQuery Validation

ぐ巨炮叔叔 提交于 2019-12-20 02:37:13
问题 I'm trying to use RequireJS to add the references to my jQuery validation script files. I have 3 script files instead of the usual 1: jquery.validate - The jquery validation library jquery.validate.unobtrusive - This adds unobtrusive validation to the jquery validation library (so you can use data attributes and it automatic wires them up). This depends on jquery.validate jquery.validate.custom - This add my own custom unobtrusive validation methods and depends on jquery.validate.unobtrusive

Preventing tsc compiler from omitting the unnecessary external modules

纵然是瞬间 提交于 2019-12-19 11:49:16
问题 There's a feature in TypeScript which I like so much and that's external modules using RequireJs and that the fact that the compiler won't include imported modules unless they are actually needed in the code. Here's an example: import A = require('./A'); import B = require('./B'); var a = new A(); When you compile the above code using tsc --module amd example.ts it will transcompile to: define(["require", "exports", './A'], function(require, exports, A) { var a = new A(); }); As you can see

Datatables Bootstrap theme not applying when using ReactJS

早过忘川 提交于 2019-12-19 10:43:20
问题 I am fairly new to RequireJS, so please be gentle! Below is a link with my HTML and JS and if you run it you will see that the datatable is initialized correctly but it is not applying the bootstrap theme. Link with problem: https://jsfiddle.net/sajjansarkar/c2f7s2jz/2/ What am I doing wrong? Below is my JS (in case the fiddle doesnt work): requirejs.config({ paths: { 'jquery': 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery', 'bootstrap': 'https://maxcdn.bootstrapcdn.com