Questions tagged [amd]

The Asynchronous Module Definition (AMD) API specifies a mechanism for defining modules such that the module and its dependencies can be asynchronously loaded. The AMD pattern is well suited for the browser environment where synchronous loading can be problematic.

The Asynchronous Module Definition (AMD) API specifies a mechanism for defining modules such that the module and its dependencies can be asynchronously loaded. This is particularly well suited for the browser environment where synchronous loading of modules incurs performance, usability, debugging, and cross-domain access problems.

API Specification https://github.com/amdjs/amdjs-api/wiki/AMD

Requirejs uses the AMD API http://requirejs.org/docs/whyamd.html

1512 questions
871
votes
6 answers

Relation between CommonJS, AMD and RequireJS?

I'm still very confused about CommonJS, AMD and RequireJS, even after reading a lot. I know that CommonJS (formerly ServerJS) is a group for defining some JavaScript specifications (i.e. modules) when the language is used outside the browser.…
gremo
  • 45,925
  • 68
  • 233
  • 380
474
votes
11 answers

Managing jQuery plugin dependency in webpack

I'm using Webpack in my application, in which I create two entry points - bundle.js for all my JavaScript files/codes, and vendors.js for all libraries like jQuery and React. What do I do in order to use plugins which have jQuery as their…
booleanhunter
  • 5,470
  • 4
  • 13
  • 20
108
votes
8 answers

How to disable the warning 'define' is not defined using JSHint and RequireJS

I uses RequireJS AMD in my project. When i run jshint on my project, it throws error like In AMD Scripts 'define' is not defined. In Mocha test cases 'describe' is not defined. 'it' is not defined. How to remove this warning in jshint?
Fizer Khan
  • 71,869
  • 26
  • 133
  • 149
98
votes
3 answers

Requirejs why and when to use shim config

I read the requirejs document from here API requirejs.config({ shim: { 'backbone': { //These script dependencies should be loaded before loading //backbone.js deps: ['underscore', 'jquery'], …
Anil Gupta
  • 2,239
  • 3
  • 22
  • 30
85
votes
3 answers

Webpack ProvidePlugin vs externals?

I'm exploring the idea of using Webpack with Backbone.js. I've followed the quick start guide and has a general idea of how Webpack works, but I'm unclear on how to load dependency library like jquery / backbone / underscore. Should they be loaded…
Henry
  • 31,972
  • 19
  • 112
  • 214
83
votes
6 answers

Is it possible to run CUDA on AMD GPUs?

I'd like to extend my skill set into GPU computing. I am familiar with raytracing and realtime graphics(OpenGL), but the next generation of graphics and high performance computing seems to be in GPU computing or something like it. I currently use an…
Lee Jacobs
  • 1,241
  • 2
  • 9
  • 21
70
votes
2 answers

Android Studio - How Can I Make an AVD With ARM Instead of HAXM?

I'm new to Android Studio. My computer doesn't support HAXM so it won't let me install that to use for virtualization. In some similar questions on this website people mention setting up a virtual device with an ARM instead of HAXM. How can I do…
user2636417
  • 2,149
  • 3
  • 12
  • 8
56
votes
2 answers

How to stop babel from transpiling 'this' to 'undefined' (and inserting "use strict")

EDIT: This is not about fat arrows. It's also not about passing this to an IIFE. It's a transpiler-related question. So I've created a simple pub-sub for a little app I'm working on. I wrote it in ES6 to use spread/rest and save some headaches. I…
JR Halchak
  • 698
  • 1
  • 5
  • 13
43
votes
1 answer

Why do we need a Single Page Application?

The Single Page Application (SPA) has come to us. A lot of new things come with it as well, like Routing, Page life cycle at client side, MVC pattern, MVVM pattern, MV* pattern,... and some of Javascript patterns also come to us like AMD pattern,…
thangchung
  • 1,950
  • 2
  • 16
  • 27
43
votes
2 answers

Expire cache on require.js data-main

I'm using require.js and r.js to package my AMD modules. I'm using jquery & requirejs via the following syntax: This all works great pre & post packaging, but I run into…
Jesse
  • 9,712
  • 9
  • 60
  • 79
37
votes
5 answers

Why do concatenated RequireJS AMD modules need a loader?

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…
Brandon Rhodes
  • 69,820
  • 15
  • 101
  • 136
36
votes
2 answers

TypeScript: compiling removes unreferenced imports

In our project we're using RequireJS as our module loader. Some of our modules will influence global libraries, and hence won't be directly used within the module they are referenced…
thomaux
  • 17,387
  • 9
  • 71
  • 94
36
votes
6 answers

supporting both CommonJS and AMD

Is there a way to create a javascript micro-library (a library that has no dependencies), that support all of the following module formats: Asynchronous Module Definition CommonJS exposing the library's exports as a global namespace object (no…
slobo
  • 751
  • 2
  • 8
  • 16
33
votes
9 answers

Dependency injection in TypeScript

I'm looking into the possibilities to do TDD with TypeScript. If I write my tests in TypeScript, is it possible to make the import statements return mocks for my class under test? Or is the only feasible approach to write the tests in pure…
Sop Killen
  • 445
  • 2
  • 5
  • 12
31
votes
5 answers

Difference between require() and define() in RequireJS?

In RequireJS, what is the basic difference between using require() Vs define(); require(['a'], function(a) { // some code }); // A.js define(['b','c','d','e'], function() { //some code }); Any use cases would be very helpful..
testndtv
  • 43,898
  • 91
  • 265
  • 396
1
2 3
99 100