Skip to content

Commit

Permalink
build-require.js works again.
Browse files Browse the repository at this point in the history
  • Loading branch information
toolness committed Jan 15, 2013
1 parent 625cb1b commit 45079a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 0 additions & 3 deletions build-i18n.js
Expand Up @@ -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) {
Expand Down
8 changes: 6 additions & 2 deletions js/require-config.js
Expand Up @@ -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() {}};
Expand Down
5 changes: 4 additions & 1 deletion js/slowparse-errors/html-to-i18n-bundle.js
Expand Up @@ -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,
Expand Down

0 comments on commit 45079a9

Please sign in to comment.