title: RequireJS Optimizer throws ReferenceError: text is not defined
body: <p>I have been using r.js to attempt to minify a fairly large project and I'm having trouble with the text plugin. I am using node.js and a build file that goes as follows:</p>
  
  <p><strong>Build File</strong></p>
  
  <pre><code>({
  
      name: '../main',
  
      baseUrl: '../../js/app',
  
      appDir: "./app",
  
      dir: 'build',
  
      paths: {
  
          jquery: '../lib/jquery/jquery-1.10.2.min',
          underscore: '../lib/underscore/underscore-min',
          backbone: '../lib/backbone/backbone-min',
          text: '../lib/require/text',
          picker: '../lib/pickadate/picker',
          pickerDate: '../lib/pickadate/picker.date',
          pickerLegacy: '../lib/pickadate/legacy'
      },
  
      mainConfigFile : '../js/main.js'
  
  })
  </code></pre>
  
  <p><strong>Main Config File</strong></p>
  
  <pre><code>requirejs.config({
  
      baseUrl: 'js/app',
  
      paths: {
  
          jquery: '../lib/jquery/jquery-1.10.2.min',
          underscore: '../lib/underscore/underscore-min',
          backbone: '../lib/backbone/backbone-min',
          text: '../lib/require/text',
          picker: '../lib/pickadate/picker',
          pickerDate: '../lib/pickadate/picker.date',
          pickerLegacy: '../lib/pickadate/legacy'
      },
  
      shim: {
          picker: ['jquery', 'pickerLegacy'],
          pickerDate: {
              deps: ['jquery', 'picker'],
              exports: 'DatePicker'
          },
          backbone: {
              deps: ['underscore', 'jquery'],
              exports: 'Backbone'
          },
          underscore: {
              exports: '_'
          },
          text : {
              exports : 'text'
          }
      }
  
  });
  </code></pre>
  
  <p>The references above are all verified correct. Whenever I try to compile this, I get the following output in the console:</p>
  
  <pre><code>node r.js -o app.build.js
  
  Tracing dependencies for: ../main
  ReferenceError: text is not defined
  In module tree:
      ../main
        app
          router
            views/pages/home
              views/panel/allStoresPanel
                text
  
  Error: ReferenceError: text is not defined
  In module tree:
      ../main
        app
          router
            views/pages/home
              views/panel/allStoresPanel
                text
  
      at eval (eval at &lt;anonymous&gt; (C:\code\Web\DixonsDashboard\deploy\_compiler\r.js:23699:64), &lt;anonymous&gt;:1:1)
  </code></pre>
  
  <p>I have no idea why it finds text to be undefined. The path to it is definitely correct - the site works like a charm in it's current expanded format. I have tried all of the options available to r.js and none of them seem to make any difference.</p>
  
  <p>If I delete the file, I get a "No such file or directory" error, so it looks like it's finding the file OK.</p>
  
  <p>Can anybody point out what I'm missing here?</p>