Louis
javascript requirejs runtime-error bundling-and-minification r.js
I bundle all my JS assets into one minified uglified file via r.js (part of requirejs).If any unhandled errors occur on the browser, I use raygun (like Airbrake) to report it back to me. The only problem is the line number I get in my error message, refers to the bundled minified file. Which doesn’t help much.Is there a way to correctly map the line number of my single minified and uglified bundled asset, into the individual JS file with the correct line number?
Peter
requirejs amd js-amd r.js almond
In my grunt.js file I’ve gotrequirejs: {dist: {options: {almond: true,wrap: true,modules: [{name: ‘main’}],mainConfigFile: “src/js/main.js”,baseUrl: “src/js”,dir: “tmp/js”,inlineText: true,preserveLicenseComments: false}} }Running grunt requirejs:dist populates the tmp/js directory with some minified files – among others a big main.js file (everything seems to be bundled in this file as expected) – however when I want to include this file like so<script type=”text/javascript” src=”tmp/main.js
Alexander Klimetschek
requirejs r.js
I am trying to integrate the r.js optimizer on the server side (Apache Sling) and face one problem: when resolving modules it always looks them up under the output directory (dir), not from within the source directory (baseUrl or appDir), doesn’t find them and thus fails./project/build.js({name: “modules/main”,dir: “/target”,baseUrl: “/sources” })If you wonder, the root path / is inside the server’s JCR repository, not a file system. Also I simplified the example a bit (hopefully without conceal
Toddish
backbone.js requirejs r.js
When I run the r.js optimizer over my Backbone.js app, I get this error:Uncaught TypeError: undefined is not a functionIt appears in the middle of the Backbone.js section of the output.I removed bits of code until I found out what was causing it, and it seems to be when I call Backbone.history.start();.I’ve created a simple app to replicate the bug, which I’ve posted below. Basically, it creates a route and ‘console.log’s ‘home’. It works fine when not optimized.To optimize the app, I use:node r
DJ Forth
requirejs ruby-on-rails-4 r.js
I am using Require.js in a rails 4 application. However in the production environment I’d like to compile into 1 file and use almond. Now obviously require.js recommends r.js, which even has a coffeescript plugin for it, but would mean running it outside of rails manually. There is the requirejs-rails gem, but this seems to have not been updated for a while and doesn’t have rails4 support. There is a couple of forked version but I get an error when I try to use them:`user_config=’: undefined
MrLipman
requirejs js-amd uglifyjs r.js
I’m using r.js to optimize/uglify my JavaScript code which is using RequireJS.One of my modules is a polyfill module:define(function(){if (!Array.prototype.filter){ /* … */ }var isPolyfillNeeded = function () { /* … */ }if (isPolyfillNeeded()) {/* polyfill implementation */} });The module causes parsing error thrown from r.js when trying to uglify it, saying:Tracing dependencies for: ../scripts/main-app Error: Parse error using UglifyJS for file: C:/…/polyfill.js Unexpected character ‘?’
Dan Ramos
javascript requirejs grunt r.js
I’m able to successfully compile my JS modules via Grunt’s requirejs task, but I’m getting undefined with any shim scripts. Here is my configrequirejs.config({“baseUrl”: “../../../components/”,”paths”: {“less”: “less.js/dist/less-1.3.3″,”datepicker”: “jquery-ui/ui/jquery.ui.datepicker”,”jquery”: “jquery/jquery”,”jqueryui”: “jquery-ui/ui/jquery-ui”,”spectrum”: “spectrum/spectrum”,”class”: “class/class”,”underscore”: “underscore-amd/underscore”,”d3″: “d3/d3″,”nv”: “nvd3/nv.d3″,”dataTables”: “data
Geoff
optimization requirejs r.js
I might be missing something here (it could be a RTFM).I am trying to use the requirejs optimizer to optimize a file and require it. but the value always comes back undefined. I created the most simple test.My module (Models/Test.js):define(function () {return “from module”; });My module after I run r.js: (Models/Test-built.js):define(‘MODELS/Test’,[],function () {return “from module”; });When I include the original in a page:<script>require([‘Models/Test’], function (item) {console.log(i