title: How can I prevent the Require.js optimizer from including the text plugin in optimized files?
body: <p><strong>tl;dr: How do I keep the text.js plugin out of my optimized file when all my text dependencies are inlined?</strong></p>
  
  <p>I'm using the <a href="http://requirejs.org/docs/optimization.html" rel="noreferrer">Require.js optimizer</a> (via Node) to optimize some of the JS files in my project. I'm using the <a href="http://requirejs.org/docs/api.html#text" rel="noreferrer">text plugin</a> to load text dependencies (HTML templates, CSS). I've got a module I want to optimize, including its dependencies, like this:</p>
  
  <pre><code>define(['text!core/core.css'], function(styles) {
      // do setup stuff, return an object
  });
  </code></pre>
  
  <p>The Require.js docs say that the <code>core/core.css</code> file will be inlined when I run the <code>r.js</code> optimizer, which I'm invoking like this:</p>
  
  <pre><code>$ r.js -o baseUrl=./src name=core out=release/test.js
  
  Tracing dependencies for: core
  Uglifying file: c:/path/release/test.js
  
  c:/path/release/test.js
  ----------------
  c:/path/src/text.js
  text!core/core.css
  c:/path/src/core.js
  </code></pre>
  
  <p>The good news is, this works. When I look at the optimized file, I can see the inlined text, something like this:</p>
  
  <pre><code>define("text!core/core.css",[],function(){return"some CSS text"}),
  define("core",["text!core/core.css"],function(a){ ... })
  </code></pre>
  
  <p>The bad news is, the text.js plugin is also included - it adds about 3K, and consists of (as far as I can tell) now entirely unnecessary code for loading external text files. I know 3K isn't much, but I'm trying to keep my code highly optimized, and as far as I understand the code for the text plugin is not at all necessary if my text dependencies are inlined. I can keep the text plugin out by adding <code>exclude=text</code> to my <code>r.js</code> call, but if I do, I get an error when I try to use the optimized code in the browser saying the text.js plugin couldn't be loaded.</p>
  
  <p>So:</p>
  
  <ol>
  <li><p>Is there any reason the text.js plugin is <strong>actually required</strong> here?</p></li>
  <li><p>If not, is there a <strong>configuration option</strong> for <code>r.js</code> that can fix this behavior, or</p></li>
  <li><p>Is there an <strong>easy shim</strong> for the text.js plugin that I can include to convince Require.js that the unnecessary plugin is loaded?</p></li>
  </ol>