Questions tagged [grunt-contrib-requirejs]

Optimize RequireJS projects using r.js.

Grunt task to optimize RequireJS projects using r.js.

80 questions
1
vote
1 answer

Can't find a way to optimize with requirejs and grunt the following:

I've this dir structure: webapp     ├──static │ ├── app │    ├── config.js │   ├── frontpage.js │   ├── profile.js │      └── utils.js Gruntfile.js And I'm trying to use grunt-contrib-requirejs to optimize my…
gotch4
  • 13,093
  • 29
  • 107
  • 170
1
vote
1 answer

RequireJS not loading the right path

I'm trying to retrofit requirejs into a project and I am intermittently getting a "404 Not Found" on files. Every, roughly, 3 or 4 reloads I get the following errors GET http://localhost:8080/build/jquery.js Uncaught Error: Script error for:…
johnjo
  • 1,785
  • 1
  • 11
  • 11
1
vote
1 answer

Requirejs optimized file is not executed

I am seriously missing some vital element on how to use the r.js optimiser. This is probably a trivial answer for many, but I can for the life of me not figure out the problem. I've set up my environment using a grunt task to build an optimised…
clearfix
  • 467
  • 1
  • 5
  • 10
1
vote
1 answer

Grunt how to set up a task to invoke a plugin more than once

I use requirejs to distribute the code into a single file. In grunt.initConfig, I have: grunt.initConfig({ requirejs: { compile: { options: { paths: requirejs_path, shim:require_shim, …
Wudong
  • 2,320
  • 2
  • 32
  • 46
1
vote
1 answer

How to include a require.js project in an app and minify both

Having two different projects, a framework and an app which uses this framework, I would like to use requirejs optimizer to minify both together. Files: /framework/ js/ some.js other.js framework.js /app/ js/ main.js …
1
vote
0 answers

Requirejs optimization with grunt

I am trying to create a requirejs optimization config with grunt and almond. Here's the config: requirejs: build: options: almond: true dir: 'build' appDir: '' baseUrl: '../client' …
1
vote
1 answer

grunt-contrib-requirejs compile gives an error while r.js works manually

I am having problems with running requirejs as a grunt task to compile my js-files. When I run it manually (r.js.cmd -o configfile.js) with the same config file everything seems to work. It seems that the grunt task is ingoring path definitions and…
anssias
  • 1,994
  • 2
  • 16
  • 21
1
vote
1 answer

'no such file' error when using grunt-requirejs compile

Since most issues with require.js build has to do with file structure and relative path reference, I created a repo here: https://github.com/ttback/requirejs-example for easier troubleshoot. The error is when i run grunt, I will get no such file or…
ttback
  • 2,051
  • 5
  • 27
  • 40
1
vote
3 answers

RequireJS Optimization

I`m using r.js to optimize my app, as i saw in several samples, i used build.json configuration file to config my optimization options. The problem is that when i set reference to the output javascript file after optimization I`m getting the…
1
vote
1 answer

Grunt build successful but requirejs dependent libraries unavailable

Problem I have a grunt build that completes successfully and most libraries are available except for those dependent on other libraries. Example For example, underscore-string depends on underscore and attaches itself to the underscore namespace as…
imrane
  • 1,542
  • 2
  • 16
  • 29
0
votes
1 answer

Broccoli and RequireJS

Hi I'm trying to improve the build time of a requirejs app using broccoli. I'm using Grunt as my task runner. This is the plugin I'm using: https://github.com/dfournier/broccoli-requirejs This is the code I have. Running the 'test' task does…
0
votes
1 answer

Concatenate and uglify Node.js files with r.js

In my backend I use Node.js together with Require.js in this way: define([ //Packages 'express', 'http' ], function ( express, http ) { //Do something with express and http }); In my front-end I use r.js to concatenate all…
0
votes
1 answer

RequireJS bundles fail in optimizer - "modules share the same URL"

tl;dr RequireJS optimizer doesn't like me defining bundle definitions on a module, but also does not find the modules if I don't define the bundles. long version I am getting the following error when trying to use the requirejs optimizer: Error:…
platzhersh
  • 1,520
  • 20
  • 35
0
votes
1 answer

Module injection problems when combining requirejs bundles and requirejs optimizer

I am currently trying to increase the performance of a rather big Angular JS application, by moving from one big chunk of javascript file, to having 3 - 4 smaller ones, that could potentially even be lazy loaded. I am using the following npm…
platzhersh
  • 1,520
  • 20
  • 35
0
votes
1 answer

Sourcemaps with require.js

I am using grunt-contrib-requirejs to munge my files into a single file and generate a sourcemap. The sourcemap seems to be valid but is 6 lines off in the debuggers in both Chrome and Firefox. I have googled quite a bit but can't find any reasons…
dtsn
  • 1,077
  • 1
  • 10
  • 17