RequireJS relative paths

Relative IDs are resolved relative to the module ID within which the ID is resolved. See AMD spec’s module id format section. There are two ways to frame a relative dependency ID into a correct context/scope: Define call Define call is the start/definition of “module.” All dependencies asked for within define() call are scoped to … Read more

require is not defined

You’re trying to use a CommonJS module from within your browser. This will not work. How are you using them? When you write import … from … in ES6 Babel will transpile these calls to a module definition called CommonJS and since CommonJS isn’t around in the browser you’ll get an undefined error from require(). … Read more

Bundling and minifying modular JavaScript (RequireJS / AMD) with ASP.NET MVC

I think the problem you’ll hit is if you used anonymous defines. If you want a combined/bundled script file that contains all your defines, you’ll have to name them. eg. define(“someModule”, [“jquery”, “ko”], function($,ko) { … }); instead of define([“jquery”, “ko”], function($,ko) { … }); If you use the file names as the module names, … Read more

Ember.js and RequireJS

EDIT (2012-01-30): I pushed a more complete example in a repo on bitbucket. I have successfully used RequireJS to load Ember.js as well as the datetime addon (github). The Ember namespace itself stays global, but all of my application’s data, including my instance of Ember.Application, is kept within modules through RequireJS. I’m also loading the … Read more

Most Efficient Multipage RequireJS and Almond setup

I think you’ve answered your own question pretty clearly. For production, we do – as well as most companies I’ve worked with option 3. Here are advantages of solution 3, and why I think you should use it: It utilizes the most caching, all common functionality is loaded once. Taking the least traffic and generating … Read more

Calling methods in RequireJs modules from HTML elements such as onclick handlers

One benefit from using AMD is to drop the need for namespaces. Trying to create them again with RequireJS will go against the patterns AMD promotes. With regard to using main.js, this is only really appropriate when you have a single page app and all your code be reference from one place. You’re free to … Read more

Dependency Injection with RequireJS

This is not actually dependency injection, but instead service location: your other modules request a “class” by a string “key,” and get back an instance of it that the “service locator” (in this case RequireJS) has been wired to provide for them. Dependency injection would involve returning the MyModel constructor, i.e. return MyModel, then in … Read more

Using the Backbone.js router to navigate through views modularized with require.js

In case anyone else is looking for a solution to this problem like I was, I’m posting what I ended up doing. If you’re using the boilerplate backbone.js, then you will have an initialize() function in router.js. I modified my initialize() function to look like the following: initialize = function () { var app_router; app_router … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)