requirejs

Optimize/build modules under parallel directories using the same config file in RequireJS

ⅰ亾dé卋堺 提交于 2019-12-11 03:02:06
问题 I have a feeling that the title just might not be explanatory :) Setup Suppose that I have the following structure: where app.js files are main bootstrapping/entry modules for the applications that look like this: app01 require.config({}); require([ 'app/component1.js' ], function(component){ // do something with component1 }); app02 require.config({}); require([ 'app/component2.js' ], function(component){ // do something with component2 }); which both work with appropriate index.html files.

ReactJS and RequireJS -> How to use multiple classes returned from one module?

ε祈祈猫儿з 提交于 2019-12-11 02:49:36
问题 I've got a RequireJS module that returns multiple ReactJS classes that I'd like to be immediately available to the JSX scope. e.g. define(["require"], function (require) { var SimpleClass = React.createClass({displayName: 'SimpleClass', render: function() { return <div>HELLO DUDE {this.props.name}</div>; } }); var AnotherSimpleClass = React.createClass({displayName: 'AnotherSimpleClass', render: function() { return <div>SUPER DUDE {this.props.name}</div>; } }); var result = {

Optimizing and loading external dependencies with requirejs

送分小仙女□ 提交于 2019-12-11 02:28:19
问题 I have a module that requires the Facebook SDK. I'm wondering how I should configure loading of the SDK so that it's handled properly by the RequireJS optimizer. In app: require.config({ paths: { 'facebook' : '//connect.facebook.net/en_US/all' } }); In build profile: { ... paths: { 'facebook' : 'empty:' } } As far as I understand it, the code above forces the optimizer to skip optimization of that script. The problem is, the SDK is no longer loaded after optimization. 回答1: As part of the

How to trigger an event from child view to parent view in backbonejs and requirejs

余生长醉 提交于 2019-12-11 02:26:53
问题 I have a parentview which dynamically creates a child view and I have triggered an event from child view to parent view and I am passing the model of the child view to parent view with some properties set. now in the parent view i have to take the model and add to collection. here is my code child view trigger code $(this.el).trigger('added', this.model); parentview event events: { "added": "addNewAttribute" }, addNewAttribute: function (model) { console.log(model); this.collection.add(model)

Visual Studio's Test Runner with Chutzpah won't recognize QUnit tests when using both Requirejs and knockoutjs

孤人 提交于 2019-12-11 01:59:29
问题 I'm trying to get VS 2013 test explorer with Chutzpah to recognize QUnit tests while I'm using require.js in combination with knockoutjs I've found some good resources listed below but I think I must just have one missing piece. This is what I used to ensure I was using Qunit and require.js together correctly. From this resource, it sounds like I need a Chutzpah.json file as well. Here is what I can reproduce: If I just use Chutzpah and qunit I can get it to work so I know I have Chutzpah

knockout.mapping & Require.js bug

孤街浪徒 提交于 2019-12-11 01:28:49
问题 So I am trying to integrate knockout.mapping.js with require.js. I have tried following this example. Unfortunately, I keep on getting this error: GET http://[url]/Scripts/app/contractor/ko.js 404 (Not Found) Uncaught Error: Script error for: ko I have set up following files: app.index.js requirejs.config({ "baseUrl": "../Scripts/app/contractor", "paths": { "app.index": "app.index", "knockout": "//cdnjs.cloudflare.com/ajax/libs/knockout/2.2.1/knockout-min", "mapping": "//cdnjs.cloudflare.com

How to load css by using requirejs?

强颜欢笑 提交于 2019-12-11 01:20:16
问题 This is my requirejs config file. I'm using require js on my angular based project. If I could load css with requirejs I would be able to organize my css files too! I'm new to requirejs concept. Any help appreciated require.config({ paths:{ 'angular' : "agular", 'app' : 'app', 'coreModel' : 'coreModel', 'test' : 'controller/test' }, shim: { 'app' : { deps :['angular','coreModel',] }, 'coreModel' : { deps : ['angular','test'] }, 'test' : { deps : ['angular',] } }, }); require(['app',],function

RequireJS - How to configure Underscore before it's loaded by Backbone?

戏子无情 提交于 2019-12-11 00:02:48
问题 I'd like to know how to load Underscore and Backbone using RequireJS and be able to configure Underscore before it's passed to Backbone. I've seen this popular question on StackOverflow about this similar topic, but I haven't been able to figure out how to get Underscore to be configured for both of the following situations: Underscore is required by itself Underscore is loaded by Backbone So my question is the following: How can I configure Underscore using RequireJS when required by itself,

RequireJS import documentation

China☆狼群 提交于 2019-12-10 23:14:24
问题 Im using in WebStorm editor. My project is using RequireJS with AMD. There is an example of code: dep.js define([], function () { var exports = { helloWorld: function() { console.log("Hello world"); } }; return exports; }); primary.js define(['dep'], function (dep) { var exports = { sayHello: function() { dep.helloWorld(); } }; return exports; }); How to document properly exports (this mainly described in other answers) and (important!) imports of such AMD modules, so WebStorm can have proper

Is r.js dependency tracing significantly slower since v2.1.16? Or is it just me?

穿精又带淫゛_ 提交于 2019-12-10 21:47:30
问题 I have noticed a dramatic increase in build time in r.js versions 2.1.16/2.1.17, as compared to 2.1.15 and before. The extra time seems to be spend during the 'Tracing dependencies for...' fase. My build.js looks something like this: ({ baseUrl: 'some/path/here', mainConfigFile: 'some/path/here', dir: 'some/path/here', modules: [ { name: "base" }, { name: "specific", exclude: ["base"] } ], findNestedDependencies: true, removeCombined: true, skipDirOptimize: true, optimize: "none" }) In run