Permalink
Browse files

build-require.js works again.

  • Loading branch information...
1 parent 625cb1b commit 45079a9b5caa3a530203c7d7afa566c746274248 @toolness committed Jan 15, 2013
Showing with 10 additions and 6 deletions.
  1. +0 −3 build-i18n.js
  2. +6 −2 js/require-config.js
  3. +4 −1 js/slowparse-errors/html-to-i18n-bundle.js
View
@@ -12,9 +12,6 @@ var requirejs = require('requirejs');
var requireConfig = require('./js/require-config');
var bundles = {};
-// For some reason r.js doesn't like our default underscore shim.
-requireConfig.shim['underscore'].exports = '_';
-
requirejs.config(requireConfig);
NLS_PATHS.forEach(function(path) {
View
@@ -73,9 +73,13 @@ var require = {
}
};
-if (typeof(module) == 'object' && module.exports)
+if (typeof(module) == 'object' && module.exports) {
+ // We're running in node.
module.exports = require;
-else (function() {
+ // For some reason requirejs in node doesn't like shim function exports.
+ require.shim['underscore'].exports = '_';
+ require.shim['backbone'].exports = 'Backbone';
+} else (function() {
var RE = /^(https?:)\/\/([^\/]+)\/(.*)\/require-config\.js$/;
var me = document.querySelector('script[src$="require-config.js"]');
var console = window.console || {log: function() {}};
@@ -2,7 +2,10 @@ define(function() {
function getDocument() {
if (typeof(document) == "undefined") {
// We're being run in node, so make a document using jsdom.
- var jsdom = require("jsdom").jsdom;
+ // Rename require to syncRequire so the r.js optimizer doesn't
+ // think the Web version of this file needs jsdom.
+ var syncRequire = require;
+ var jsdom = syncRequire("jsdom").jsdom;
var doc = jsdom('<html></html>', null, {
features: {
FetchExternalResources: false,

0 comments on commit 45079a9

Please sign in to comment.