Menu
  • HOME
  • TAGS

Can I combine RequireJs modules AND require.js itself into one js-bundle

javascript,requirejs,requirejs-optimizer

The answer is here http://requirejs.org/docs/optimization.html#onejs I had to include require.js through 'include' r.js option. With gulp task and gulp-requirejs it looks like this: requirejs({ paths: { requireLib: 'lib/require' }, include: ['requireLib'], out: 'bundle.js' }) .pipe(insert.append('require(["app"]);')) Notice I had to append require(["app"]) to the end of js-bundle to start main module....

How to use RequireJS optimizer in Play framework?

requirejs,webjars,requirejs-optimizer,playframework-2.4

It turns out that RequireJS optimization support does not apply to all Webjars, but rather limited to Classic Webjars. Even then, a webjar build file has to be included with the regular module in order for rjs to work. If you look at the jQuery classic webjar, for example, you...

Prevent optimization of text! and json! plugins on requirejs optimization tool

javascript,requirejs,requirejs-text,requirejs-optimizer

The json plugin uses if (( config.isBuild && (config.inlineJSON === false || name.indexOf(CACHE_BUST_QUERY_PARAM +'=') !== -1)) || (url.indexOf('empty:') === 0)) { when the optimiser runs so you have a couple of options. Add the build config option inlineJSON: false, Add !bust to the end of the json require. require('json!/pagelang/login!bust'), or...

Trouble with require js shims and r.js

requirejs,grunt-contrib-requirejs,requirejs-optimizer

This was a bug, fix tracked here: https://github.com/jrburke/r.js/issues/813

Optimization fails when passing a variable with a list of dependencies to define()

requirejs,requirejs-optimizer

r.js cannot handle dependencies that are specified as something else than a literal array. This is why this works: define(['globals', 'templates'], function(globals, templates)... But this does not work: var deps = ['globals', 'templates']; define(deps, function(globals, templates)... To make it work r.js would have to perform code analysis, which would make...

Play 2.3 requireJs optimization and shim for multiple modules

playframework-2.3,requirejs-optimizer,sbt-web

Instead of requireJs use: RjsKeys.modules := Seq( WebJs.JS.Object("name" -> "mainAccount"), WebJs.JS.Object("name" -> "mainOrg"), WebJs.JS.Object("name" -> "mainPublic") ) Instead of requireJsShim use RjsKeys.mainConfig := "build" I think you can just omit requireJsFolder as baseUrl is considered to be either js or javascripts by default. See here: https://github.com/sbt/sbt-rjs/blob/master/src/main/scala/com/typesafe/sbt/rjs/SbtRjs.scala#L104 If you want...

Requirejs optimizer and mainConfigFile errors [closed]

javascript,requirejs,require,requirejs-optimizer

ResetPassView appears twice in your paths. That's an illegal JavaScript object. That's your error. The error message: SyntaxError: Duplicate data property in object literal not allowed in strict mode was a gigantic clue that this was the problem. Cut and paste your config into an empty .js file, have node...

RequireJS baseUrl and multiple optimized files

requirejs,requirejs-optimizer

Ok, I figured this out. It was simple, really, just a case of too much configuration. When you load your script using data-main, the baseUrl is set relative to that file. So, if I specified js/main, the baseUrl would be js. But, since I explicitly specified baseUrl in the config...

RequireJS: Optimized files and older browsers

javascript,requirejs,requirejs-optimizer

Any code that causes a parse error will need to be in a different file to your config and boot. You could put the browser check in the config file and make it add different paths if it is IE. There is also the IE conditional html comments which can...