Questions tagged [requirejs]
RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments, like Rhino and Node.js. If you are using the require call that comes bundled with Node.js then you are NOT using RequireJS. Please do not use this tag for such cases. Use the require tag instead.
requirejs
7,731
questions
2
votes
1
answer
2k
views
Using the optimizer in requirejs to group and load files
We have just started using requirejs in our project and we are loving
it. Currently we are just using it to manage our many jQuery plugins
the site runs on, so are barely scratching the surface of its
...
13
votes
3
answers
12k
views
Requirejs loading plugins
I'm trying to load a plugin using requirejs but occasionally get an error, "$.fn is undefined" but if I reload the page the error disappears almost like now jquery is cached the problem is removed. I'...
4
votes
1
answer
9k
views
How to load a script synchronously with RequireJS
I am using RequireJS in ASP.NET. There is a user control that includes a script file, and registers a startup script in order to initialize itself. Here's the generated code:
<script src="script/...
2
votes
1
answer
4k
views
requireJS : Best way to add jQuery plugins?
I am having trouble working out the best way to add a jquery plugin when using requireJS to structure my javascript.
The plugins seem to be recognised before I optimize my scripts but then after ...
3
votes
1
answer
6k
views
RequireJS : Problem including jquery easing pack after optimization
I want to include the jquery easing pack into my application. Before requireJS files have been 'optimized' it works fine. Now I am using the optimized version when ever I call an animation that uses ...
0
votes
1
answer
6k
views
requireJS Optimization : "Uncaught TypeError: undefined is not a function"
I am using requireJS for the first time. I got it working fine then came to optimize the files to minify and concatenate and now I get the error "Uncaught TypeError: undefined is not a function" the ...
1
vote
1
answer
795
views
RequireJS Optimization Reference Error
I am using RequireJS to organise my JS files. I am attempting optimize my files into one main JS file.
I am using the following command to do this:
/home/plugins/requireJS/build/build.sh name=main ...
9
votes
4
answers
3k
views
requireJS : How to structure Javascript for an entire site?
I have 3000+ lines of javascript that I need to get into a sensible/maintainable structure. I have chosen to use requireJS as it has been recommend to me by a few people. I have a bunch of variables ...
2
votes
1
answer
3k
views
requirejs - how can I get the "baseUrl" info from within a plugin?
I'm building requirejs plugins and loading them on my page. On my page, however, I'm setting a baseUrl value, so that I can just load plugins with paths like "tools/foo" instead of "/static/js/blah/...
9
votes
5
answers
3k
views
Getting jsdoc and Crockford's design patterns to get along
I'm using Douglas Crockford's design pattern to implement private, privileged and public methods. It basically looks something like this (using RequireJS):
define(function () {
return function () ...
138
votes
4
answers
33k
views
What's the difference between Require.js and simply creating a <script> element in the DOM? [closed]
What's the difference between using Require.JS amd simply creating a <script> element in the DOM?
My understanding of Require.JS is that it offers the ability to load dependencies, but can this ...
80
votes
7
answers
31k
views
How to handle circular dependencies with RequireJS/AMD?
In my system, I have a number of "classes" loaded in the browser each a separate files during development, and concatenated together for production. As they are loaded, they initialize a property on a ...
68
votes
3
answers
56k
views
RequireJS: How to define modules that contain a single "class"?
I have a number of JavaScript "classes" each implemented in its own JavaScript file. For development those files are loaded individually, and for production they are concatenated, but in both cases I ...
21
votes
3
answers
10k
views
Use requirejs and jquery, without clobbering global jquery?
I'm using requirejs for the first time on a project. I'm working in an environment that has a lot of Javascript in place already, and I'm looking for clean ways to introduce my own code.
The problem ...
1
vote
1
answer
1k
views
Why is RequireJS not working when using priority?
When using RequireJS without "priority" it works:
require(
{},
[
'js/libs/jquery/jquery-1.4.4.js',
'js/libs/utils.js',
'js/app/app.index.js',
'js/app/app.framework.js',
'js/...